jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Seidel. Robert" <Robert.Sei...@aeb.de>
Subject AW: AW: AW: New information about my last email...
Date Fri, 28 Jan 2011 12:22:07 GMT
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:jarias@ujaen.es] 
Gesendet: Freitag, 28. Januar 2011 13:05
An: users@jackrabbit.apache.org
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.


Mime
View raw message