Package org.sete.domain

Examples of org.sete.domain.UserPrivilege


        UserRolePrivilege p = new UserRolePrivilege();
        p.setUserRoleType(TypeUtil.forKey(UserRoleType.class, roleKey.getKey()));

        Set<UserPrivilege> privs = new HashSet<UserPrivilege>();
        UserPrivilege up = null;
        PrivilegeActionType pat = null;

        for(PrivilegeActionType.Key ak : auths.keySet()) {
            pat = TypeUtil.forKey(PrivilegeActionType.class, ak.getKey());
            for(UserPrivilegeType.Key pk : auths.get(ak)) {
                up = new UserPrivilege();
                up.setUserPrivilegeType(TypeUtil.forKey(UserPrivilegeType.class, pk.getKey()));
                up.setPrivilegeActionType(pat);
                privs.add(up);
            }
        }

        p.setUserPrivileges(privs);
View Full Code Here


       
        final UserRolePrivilege urp = roleDao.getAllUserRoles().get(0);
        assertTrue( "judge".equals(urp.getUserRoleType().getKey()) );
        assertTrue( 1 == urp.getUserPrivileges().size() );
       
        final UserPrivilege up = (UserPrivilege)urp.getUserPrivileges().iterator().next();
        assertTrue( "manageMyProject".equals(up.getUserPrivilegeType().getKey()) );
        assertTrue( "r".equals(up.getPrivilegeActionType().getKey()) );
    }
View Full Code Here

       
        final UserRolePrivilege urp = roleDao.getAllUserRoles().get(0);
        assertTrue( "judge".equals(urp.getUserRoleType().getKey()) );
        assertTrue( 1 == urp.getUserPrivileges().size() );
       
        final UserPrivilege up = (UserPrivilege)urp.getUserPrivileges().iterator().next();
        assertTrue( "manageJudgeResults".equals(up.getUserPrivilegeType().getKey()) );
        assertTrue( "r".equals(up.getPrivilegeActionType().getKey()) );
    }
View Full Code Here

                                          List<PrivilegeActionType.Key> actionKeys) {
        UserRolePrivilege p = new UserRolePrivilege();
        p.setUserRoleType(TypeUtil.forKey(UserRoleType.class, roleKey.getKey()));

        Set<UserPrivilege> privs = new HashSet<UserPrivilege>();
        UserPrivilege up = null;

        for(UserPrivilegeType.Key pk : privKeys) {
            up = new UserPrivilege();
            up.setUserPrivilegeType(TypeUtil.forKey(UserPrivilegeType.class, pk.getKey()));
            for(PrivilegeActionType.Key ak : actionKeys) {
                up.setPrivilegeActionType(TypeUtil.forKey(PrivilegeActionType.class, ak.getKey()));
            }
            privs.add(up);
        }

        p.setUserPrivileges(privs);
View Full Code Here

            urt.setKey(roleKey);
            urp.setUserRoleType( urt );

            final Set userPrivs = new HashSet();
            {
                final UserPrivilege up = new UserPrivilege();
                {
                    final UserPrivilegeType upt = new UserPrivilegeType();
                    upt.setKey(privilegeKey);
                    up.setUserPrivilegeType( upt );

                    final PrivilegeActionType pat = new PrivilegeActionType();
                    pat.setKey(actionKey);
                    up.setPrivilegeActionType( pat );
                }

                userPrivs.add(up);
            }
View Full Code Here

        //and update/add role privileges for the user role we found
        {
            for(final RolePrivilegeVo rpvo: vo.getUserRolePrivileges())
            {
                //see whether this user privilege is for update or for add
                UserPrivilege foundUserPrivilege = null;
                for(final UserPrivilege up: foundRolePriv.getUserPrivileges())
                {
                    if( up.getUserPrivilegeType().getKey().equals(rpvo.getUserRolePrivilege()) )
                    {
                        foundUserPrivilege = up;
                        break;
                    }
                }

                if( null == foundUserPrivilege )
                {
                    foundUserPrivilege = new UserPrivilege();
                    UserPrivilegeType.Key uptKey = UserPrivilegeType.Key.findKey(rpvo.getUserRolePrivilege());
                    foundUserPrivilege.setUserPrivilegeType(UserPrivilegeType.forKey(uptKey));
                    foundRolePriv.getUserPrivileges().add(foundUserPrivilege);
                }

                PrivilegeActionType.Key patKey = PrivilegeActionType.Key.findKey(rpvo.getPrivilegeActions());
                foundUserPrivilege.setPrivilegeActionType(PrivilegeActionType.forKey(patKey));
            }
        }

        //and delete the ones that weren't updated or added
        {
            final Iterator it = foundRolePriv.getUserPrivileges().iterator();
            while(it.hasNext())
            {
                final UserPrivilege urp = (UserPrivilege)it.next();

                //see whether it was in vo
                boolean foundIt = false;
                for(final RolePrivilegeVo rpvo: vo.getUserRolePrivileges())
                {
                    if( rpvo.getUserRolePrivilege().equals(urp.getUserPrivilegeType().getKey()) )
                    {
                        foundIt = true;
                        break;
                    }
                }
View Full Code Here

        UserRolePrivilege p = new UserRolePrivilege();

        p.setUserRoleType(TypeUtil.forKey(UserRoleType.class, vo.getUserRole()));

        Set<UserPrivilege> privs = new HashSet<UserPrivilege>();
        UserPrivilege up = null;
        for(String pk: vo.getUserRolePrivileges())
        {
          up = new UserPrivilege();
          up.setUserPrivilegeType(TypeUtil.forKey(UserPrivilegeType.class, pk));
          up.setPrivilegeActionType(TypeUtil.forKey(PrivilegeActionType.class, PrivilegeActionType.READ));
          privs.add(up);
        }

        p.setUserPrivileges(privs);
View Full Code Here

        Set<UserRolePrivilege> rolePrivs = new HashSet<UserRolePrivilege>();
        UserRolePrivilege p = new UserRolePrivilege();
        p.setUserRoleType(TypeUtil.forKey(UserRoleType.class, roleKey));

        Set<UserPrivilege> privs = new HashSet<UserPrivilege>();
        UserPrivilege up = null;

        for(String pk : privKeys) {
            up = new UserPrivilege();
            up.setUserPrivilegeType(TypeUtil.forKey(UserPrivilegeType.class, pk));
            for(String ak : actionKeys) {
                up.setPrivilegeActionType(TypeUtil.forKey(PrivilegeActionType.class, ak));
            }
            privs.add(up);
        }

        p.setUserPrivileges(privs);
View Full Code Here

        //and update/add role privileges for the user role we found
        {
            for(final RolePrivilegeVo rpvo: vo.getUserRolePrivileges())
            {
                //see whether this user privilege is for update or for add
                UserPrivilege foundUserPrivilege = null;
                for(final UserPrivilege up: foundRolePriv.getUserPrivileges())
                {
                    if( up.getUserPrivilegeType().getKey().equals(rpvo.getUserRolePrivilege()) )
                    {
                        foundUserPrivilege = up;
                        break;
                    }
                }

                if( null == foundUserPrivilege )
                {
                    foundUserPrivilege = new UserPrivilege();
                    UserPrivilegeType.Key uptKey = UserPrivilegeType.Key.findKey(rpvo.getUserRolePrivilege());
                    foundUserPrivilege.setUserPrivilegeType(UserPrivilegeType.forKey(uptKey));
                    foundRolePriv.getUserPrivileges().add(foundUserPrivilege);
                }

                PrivilegeActionType.Key patKey = PrivilegeActionType.Key.findKey(rpvo.getPrivilegeActions());
                foundUserPrivilege.setPrivilegeActionType(PrivilegeActionType.forKey(patKey));
            }
        }

        //and delete the ones that weren't updated or added
        {
            final Iterator it = foundRolePriv.getUserPrivileges().iterator();
            while(it.hasNext())
            {
                final UserPrivilege urp = (UserPrivilege)it.next();

                //see whether it was in vo
                boolean foundIt = false;
                for(final RolePrivilegeVo rpvo: vo.getUserRolePrivileges())
                {
                    if( rpvo.getUserRolePrivilege().equals(urp.getUserPrivilegeType().getKey()) )
                    {
                        foundIt = true;
                        break;
                    }
                }
View Full Code Here

        UserRolePrivilege p = new UserRolePrivilege();
        p.setUserRoleType(TypeUtil.forKey(UserRoleType.class, roleKey.getKey()));

        Set<UserPrivilege> privs = new HashSet<UserPrivilege>();
        UserPrivilege up = null;
        PrivilegeActionType pat = null;

        for(PrivilegeActionType.Key ak : auths.keySet()) {
            pat = TypeUtil.forKey(PrivilegeActionType.class, ak.getKey());
            for(UserPrivilegeType.Key pk : auths.get(ak)) {
                up = new UserPrivilege();
                up.setUserPrivilegeType(TypeUtil.forKey(UserPrivilegeType.class, pk.getKey()));
                up.setPrivilegeActionType(pat);
                privs.add(up);
            }
        }

        p.setUserPrivileges(privs);
View Full Code Here

TOP

Related Classes of org.sete.domain.UserPrivilege

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.