cancel
Showing results for 
Search instead for 
Did you mean: 

Javascript

xerox
Champ in-the-making
Champ in-the-making
When I execute my simple javascript in de folder sandbox(a folder under company home) it won't do the right thing

code: space.setPermission("Read", "test" );

I expect it gives the group "test" read acces to the space sandbox, but this isn't true. It gives read acces to the space comapny home.
can anyone explain this ?

friendly regards,
Nick
9 REPLIES 9

xerox
Champ in-the-making
Champ in-the-making
is this a bug?

kevinr
Star Contributor
Star Contributor
Are you sure the 'space' object is pointing to the node you think it is? i.e. have you tried viewing the space.name value? Are you running the script in the context of an inherited rule? As then the space object will be the space the rule was originally created in. I've checked the code and there is no bug that i can see.

Thanks,

Kevin

xerox
Champ in-the-making
Champ in-the-making
space.name.value gives company home, (the parent of sandboxfolder)

I did the following:
browsed to the details of the folder sandbox and then clicked on run action.
There I executed the script.
So it seems space actually means parent?

xerox
Champ in-the-making
Champ in-the-making
I'm almost sure it's a bug.
If I use my script as a rule in a folder , than it works fine.
(space is current space)
but when I use my script as "run action" ,than is doesn't work logical.
(space is than the parent space)

kevinr
Star Contributor
Star Contributor
If it's working from a rule then thats ok at least - but yes it sounds like maybe there is a bug picking up the correct space context when executing a script from Run Action. I'll take a look at that area and see if i can find the problem.

Thanks,

Kevin

xerox
Champ in-the-making
Champ in-the-making
thx for looking…
please let me know when this bug is gone

kevinr
Star Contributor
Star Contributor
I have found the problem. There is a bug which is allocating the current space to the 'document' script context object if (and only if) the script is executed via Run Action for a space. I have raised it:
http://issues.alfresco.com/browse/AR-1527

It will be fixed for 2.1.

Thanks,

Kevin

kevinr
Star Contributor
Star Contributor
Fix checked in.

xerox
Champ in-the-making
Champ in-the-making
thx…