Package org.codehaus.plexus.redback.rbac

Examples of org.codehaus.plexus.redback.rbac.UserAssignment


            String principal = UserManager.GUEST_USERNAME;

            try
            {
                UserAssignment ua;

                if ( rbacManager.userAssignmentExists( principal ) )
                {
                    ua = rbacManager.getUserAssignment( principal );
                }
                else
                {
                    ua = rbacManager.createUserAssignment( principal );
                }

                ua.addRoleName( ArchivaRoleConstants.toRepositoryObserverRoleName( repoId ) );
                rbacManager.saveUserAssignment( ua );
            }
            catch ( RbacManagerException e )
            {
                log.warn( "Unable to add role [" + ArchivaRoleConstants.toRepositoryObserverRoleName( repoId ) + "] to "
View Full Code Here


    }

    protected void restoreGuestInitialValues( String userId )
        throws Exception
    {
        UserAssignment userAssignment = null;
        try
        {
            userAssignment = rbacManager.getUserAssignment( userId );
        }
        catch ( RbacObjectNotFoundException e )
        {
            log.info( "ignore RbacObjectNotFoundException for id {} during restoreGuestInitialValues", userId );
            return;
        }
        userAssignment.setRoleNames( Lists.newArrayList( "Guest" ) );
        rbacManager.saveUserAssignment( userAssignment );
        CacheManager.getInstance().clearAll();
    }
View Full Code Here

            String principal = UserManager.GUEST_USERNAME;

            try
            {
                UserAssignment ua;

                if ( rbacManager.userAssignmentExists( principal ) )
                {
                    ua = rbacManager.getUserAssignment( principal );
                }
                else
                {
                    ua = rbacManager.createUserAssignment( principal );
                }

                ua.addRoleName( ArchivaRoleConstants.toRepositoryObserverRoleName( repoId ) );
                rbacManager.saveUserAssignment( ua );
            }
            catch ( RbacManagerException e )
            {
                log.warn(
View Full Code Here

            manager.saveRole( role );
        }

        for ( Iterator i = database.getUserAssignments().iterator(); i.hasNext(); )
        {
            UserAssignment userAssignment = (UserAssignment) i.next();

            manager.saveUserAssignment( userAssignment );
        }
    }
View Full Code Here

        {
            return getUserAssignment( principal );
        }
        catch ( RbacObjectNotFoundException e )
        {
            UserAssignment ua = new MemoryUserAssignment();
            ua.setPrincipal( principal );

            fireRbacUserAssignmentSaved( ua );

            return ua;
        }
View Full Code Here

        List allUA = getAllUserAssignments();
        List userAssignments = new ArrayList();

        for ( Iterator i = allUA.iterator(); i.hasNext(); )
        {
            UserAssignment ua = (UserAssignment) i.next();

            for ( Iterator j = roleNames.iterator(); j.hasNext(); )
            {
                String roleName = (String) j.next();

                if ( ua.getRoleNames().contains( roleName ) )
                {
                    userAssignments.add( ua );
                    break;
                }
            }
View Full Code Here

TOP

Related Classes of org.codehaus.plexus.redback.rbac.UserAssignment

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.