Hi Javier,

here is some code snippet:

        /**
         * returns the access control list for the node path
         * @param connection the connection to the jackrabbit repository
         * @param path the node path
         * @return access control list (applicable or set)
         * @throws AccessDeniedException
         * @throws RepositoryException
         */
        private AccessControlList getAccessList(JcrConnection connection, 
String path) throws AccessDeniedException, RepositoryException {
                AccessControlManager acMngr = 
connection.getSession().getAccessControlManager();
                AccessControlPolicyIterator it = 
acMngr.getApplicablePolicies(path);
                while(it.hasNext()) {
                        AccessControlPolicy acp = it.nextAccessControlPolicy();
                        if (acp instanceof AccessControlList) {
                                return (AccessControlList) acp;
                        }
                }
                AccessControlPolicy[] acps = acMngr.getPolicies(path);
                for (AccessControlPolicy accessControlPolicy : acps) {
                        if (accessControlPolicy instanceof AccessControlList) {
                                return (AccessControlList) accessControlPolicy;
                        }
                }
                throw new RepositoryException("No AccessControlList at " + 
path);
        }

Regards, Robert

-----Ursprüngliche Nachricht-----
Von: Javier Arias [mailto:[email protected]] 
Gesendet: Freitag, 28. Januar 2011 13:05
An: [email protected]
Betreff: Re: AW: AW: New information about my last email...

Hi everyone, I have called getPolicies function. It returns
AccessControlPolicy[]. I have called AccessControlPolicy[].length and it
returns 1 but I do not know how manage the class AccesControlPolicy
becusethis object does not have different methods distinct inherited
methods form Object.  

Grant privileges to an user is being a very difficult task!

Can someone give me an implementation example to grant privileges to an
user? This code could help me a lot.

Thanks. Regards.


Reply via email to