AnsweredAssumed Answered

extending PermissionService

Question asked by andrew_ser on May 6, 2006
Latest reply on Aug 10, 2008 by hbf
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.

Outcomes