principalClass = "org.jboss.dashboard.security.principals.UserGroupPrincipal";
principalName = transformPrincipalName(principalName, principalClass, attributes);
Constructor principalConstructor = Class.forName(principalClass).getConstructor(new Class[]{String.class});
DefaultPrincipal principal = (DefaultPrincipal) principalConstructor.newInstance(new Object[]{principalName});
Policy securityPolicy = SecurityServices.lookup().getSecurityPolicy();
securityPolicy.addPermission(principal, permission, Boolean.valueOf(readonly));
securityPolicy.save();
}