There seems to be another (little) issue.
I've fixed the path bug, but when I run the code, I see this in log files: 

[b]ERROR  info.magnolia.cms.security.MgnlRole 21.12.2012 11:05:04 -- can't 
remove permission[/b]
javax.jcr.RepositoryException: Cannot save a new item: node /my-role
        at 
org.apache.jackrabbit.core.ItemImpl.getTransientStates(ItemImpl.java:278)
        at org.apache.jackrabbit.core.ItemImpl.save(ItemImpl.java:950)
        at info.magnolia.cms.core.DefaultContent.save(DefaultContent.java:532)
        at 
info.magnolia.cms.security.MgnlRole.removePermission(MgnlRole.java:103)

Here you see "remove", but happen also with "add".
The Java code is the following: 

[code]
SecuritySupport securitySupport = SecuritySupport.Factory.getInstance();
RoleManager roleManager = securitySupport.getRoleManager();
Role role = roleManager.getRole(this.role);
if (role == null) {
  ctx.warn("Role \"" + this.role + "\" not found, can't add permissions to " + 
path + ".");
} else {
  try {
    if (StringUtils.equals("/", path)) {
      // a single acl rule is required
      role.addPermission(this.repository, this.includeSubNodes ? this.path + 
"*" : this.path, this.permission);
    } else {
      role.addPermission(this.repository, this.path, this.permission);
      if (this.includeSubNodes) {
        role.addPermission(this.repository, this.path + "/*", this.permission);
      }
    }
  } catch (UnsupportedOperationException e) {
    ctx.warn("Can't update role \"" + this.role
    + "\" due to an unsupported operation exception. This is most likely the 
case if the roles are managed externally.");
  }
}
[/code]

This is probably because we are running in InstallationContext, not in a normal 
MgnlContext.
By the way, the nodes are updated anyway, but the log says errors.
Can you confirm again?
Thanks a lot..
Matteo

-- 
Context is everything: 
http://forum.magnolia-cms.com/forum/thread.html?threadId=5f0c27c3-1b95-412d-abd6-d818cb9a9b40


----------------------------------------------------------------
For list details, see http://www.magnolia-cms.com/community/mailing-lists.html
Alternatively, use our forums: http://forum.magnolia-cms.com/
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------

Reply via email to