jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shivalika <destinee...@gmail.com>
Subject Setting Privileges
Date Thu, 08 Jul 2010 04:40:06 GMT

Hello users,

I have developed a login module called as SampleLoginModule & created its
.jar file. This file has been put into the repository & the path in
Repository.xml is changed.

Our this Login module works as:

1.admin logs in after being authenticated.
2.after login, the admin can create users.
The created users are written to a file Users.xml
As well as, i used the createUser method of UserManagerImpl -  it creates
users as JCR nodes.

public User createUser(String userID, String password) throws

So far, working good!!

Now i want to add privileges for this particular created user at the time of

I did some R&D as :

public void access_control(Node testRootNode, PrincipalImpl principal)
throws UnsupportedRepositoryOperationException, RepositoryException {
        try {
            AccessControlPolicy acp = null;
            AccessControlManager acm = session.getAccessControlManager();
            System.out.println("1" + acm.toString());

            AccessControlPolicy[] it =
            System.out.println("2:::" + it.length);
            for (int i = 0; i < it.length; i++) {
                acp = it[i];
            System.out.println("3" + it.toString());
            Privilege[] privileges = new
            System.out.println("3:::" + privileges.length);

            ((AccessControlList) acp).addAccessControlEntry(new
PrincipalImpl(session.getUserID()), privileges);
            acm.setPolicy(testRootNode.getPath(), acp);


        } catch (Exception re) {
            System.out.println("Exception caught:" + re);

I get an exception as:
Exception caught:java.lang.ClassCastException:
cannot be cast to javax.jcr.security.AccessControlList

Moreover, the session is for the admin user, not the created user.

So, what i want is that as soon as the user is created by Admin, the
privileges are being set for this particular created user in question.

Any comments and suggestions would help greatly.



View this message in context: http://jackrabbit.510166.n4.nabble.com/Setting-Privileges-tp2281799p2281799.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.

View raw message