cancel
Showing results for 
Search instead for 
Did you mean: 

extending PermissionService

andrew_ser
Champ in-the-making
Champ in-the-making
Hello,

I was wondering if there is an way to check for permissions without explicitly setting current user with AuthenticationComponent.setCurrentUser(). I am looking for an API which would resemble to:

   hasPermission(NodeRef nodeRef, String authority, String permission);
   getPermissions(NodeRef nodeRef, String authority);
   // etc…

Right now the only way to do it in scheduled job is:

  for ( User user:users ) {
      this.authenticationComponent.setCurrentUser( user.getUserName() );
      if ( this.permissionService.hasPermission(nodeRef, permission) ) {
        // do something
      }
  }

Am I missing something ?

Many thanks in advance,
Andrei.
6 REPLIES 6

andy
Champ on-the-rise
Champ on-the-rise
Hi

You are not missing something.
This is not yet exposed.
It is on the list of things to do as a few people have asked for it.

Regards

Andy

andrew_ser
Champ in-the-making
Champ in-the-making
It is on the list of things to do as a few people have asked for it.

Would you be interested if this part is contributed ?

chrisb
Champ in-the-making
Champ in-the-making
Hi,

I know this thread is a bit old now, but did anything like the modified permissions test method:

hasPermission(NodeRef nodeRef, String authority, String permission);

make it into one of the current releases?

I need to check to see if a particular user has a specific role/permission on list of spaces. The user in question is unfortunately NOT the user running the script containing this code.

I can do it using the getPermissions() method on each space and parsing the resulting permission strings, BUT it seems extremely inefficient  :?  Seems like an extension of this type to the people root object in the Javascript API, plus a few other permissions related methods would be very popular.

Alternatively am I missing something on the Lucene search side of things that would allow role / permissions based content searches?

Chris

hbf
Champ on-the-rise
Champ on-the-rise
Me, too, I need exactly this feature: hasPermission(NodeRef nodeRef, String authority, String permission);

Would you be interested if this part is contributed ?

Andrew_ser, does this mean you have an implementation? Would you share it with us?

andy
Champ on-the-rise
Champ on-the-rise
Hi

The API is not extended in the current release. Lucene does not expose anything that would help.

Currently, the only way this can be done is in Java code using AuthenticationUtil RunAs support.

Andy

hbf
Champ on-the-rise
Champ on-the-rise
The API is not extended in the current release. Lucene does not expose anything that would help.

Any news on this regarding 2.9b/3.0?

Thanks in advance!
Kaspar