cancel
Showing results for 
Search instead for 
Did you mean: 

script javascript API in java

litllel
Champ in-the-making
Champ in-the-making
Hello guys, how can i make a script in javascript to disable user access in alfresco which can be execute in java i don't understand how i can do it i know we can use thos function in javascript API
 
if(people.isAccountEnabled("Joe")){
        people.disableAccount("Joe");       
    }
    else{
        people.enableAccount("Joe");
    }


but how can i choose the store and lauchn the search
2 REPLIES 2

steven_okennedy
Star Contributor
Star Contributor
Hi litlleL

This request seems to be the "wrong way round" at least from the normal use perspective, as it's much more usual to write a class in Java and expose methods to Javascript rather than the other way round Smiley Happy

Does the script really need to be written in Javascript?  Can you write the whole approach in Java instead?  The Javascript APIs expose only a subset of the capabilities of the core Java ones so there may be capabilities that aren't available to you.

Conversely, do you have to run this explicitly using Java (I'm assuming custom Java here)?  An alternative is use something like the JavaScript console (https://github.com/share-extras/js-console) which allows you to run arbitrary scripts directly from the Admin Screens in Share.

If you really want to go down the route where you e.g. run scripts written in JavaScript from within a custom action/behaviour/scheduled job written in Java, you can use the ActionService to get an instance of a ScriptActionExecutor and tell it the location of the script you wish to run.

<cite>but how can i choose the store and lauchn the search</cite>
I'm not sure what you mean here, enabling or disabling users doesn't really involve content stores, and not sure what kind of search you're looking to launch.  Could you outline what you're trying to do?


Hi, I wasn't able to do it in JAVA 'cause the user I was trying to disable was a user created from an LDAP sync. I finally done it by changing the way all users from Ldap was created in alfresco. thanks