jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Justin Edelson <jus...@justinedelson.com>
Subject Re: problem after registering a custom privilege
Date Wed, 02 May 2012 14:25:32 GMT
You need to check if the privilege already exists before registering it.

Justin

On Wed, May 2, 2012 at 10:13 AM, Malzer Ferdinand OSP sIT <
Ferdinand.Malzer@s-itsolutions.at> wrote:

> Hello,
> I try to register a custom privileg with the following code.
>
>
>            session = repository.login(new SimpleCredentials(user,
> pwd.toCharArray()), workspace);
>            JackrabbitWorkspace jrws = (JackrabbitWorkspace)
> session.getWorkspace();
>            PrivilegeManager privMgr = jrws.getPrivilegeManager();
>            privMgr.registerPrivilege("gcms_role_chief", false, new
> String[] {});
>            session.save();
>
> The code seems to work fine (it runs with no exception).
> The next time when I try to access the repository I get the following
> exception:
>
> Exception in thread "main" javax.jcr.RepositoryException: Duplicate entry
> for custom privilege with name {}gcms_role_chief
>        at
> org.apache.jackrabbit.core.security.authorization.PrivilegeRegistry$CustomPrivilegeStore.load(PrivilegeRegistry.java:1078)
>        at
> org.apache.jackrabbit.core.security.authorization.PrivilegeRegistry$CustomPrivilegeStore.access$100(PrivilegeRegistry.java:1046)
>        at
> org.apache.jackrabbit.core.security.authorization.PrivilegeRegistry.<init>(PrivilegeRegistry.java:165)
>        at
> org.apache.jackrabbit.core.RepositoryImpl.<init>(RepositoryImpl.java:273)
>        at
> org.apache.jackrabbit.core.RepositoryImpl.create(RepositoryImpl.java:589)
>        at
> at.spardat.jackrabbit.test.DumpRepository.main(DumpRepository.java:46)
>
> Does somebody know how I could register a custom privilege the right way?
>
> Thx in advance!
> ferry malzer
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message