Examples of UserRolePrivilege


Examples of org.sete.domain.UserRolePrivilege

        //set "mocked" Objects that talks to db layer
        service.setUserRolePrivilegeDao(urpDao);
        service.setPasswordEncoder(pswdE);
        service.setSeteUserDao(suDao);
       
        UserRolePrivilege urp = new UserRolePrivilege();
     
        expect(userDao.findByLoginName(csuvo.getLoginName())).andStubReturn(null);
        expect(urpDao.findRolePrivilege("Student")).andReturn(urp);
        expect(urpDao.findRolePrivilege("")).andReturn(urp);
        expect(pswdE.encodePassword(csuvo.getPassword(), null)).andStubReturn("sete");
View Full Code Here

Examples of org.sete.domain.UserRolePrivilege

     * @throws IllegalStateException - thrown if any UserRole does not have a defined RolePrivileges.
     */
    private Set<UserRolePrivilege> buildUserRolePrivileges(CreateSeteUserVo vo) {
      //Set User Roles --
      Set<UserRolePrivilege> rolePrivs = new HashSet<UserRolePrivilege>();
      UserRolePrivilege urp = null;
      for(String pk: vo.getUserRoles()){
        urp = userRolePrivilegeDao.findRolePrivilege(pk);
        if(urp != null) {
          rolePrivs.add(urp);
        }
View Full Code Here

Examples of org.sete.domain.UserRolePrivilege

       
        //load again user roles with privileges
        final List<UserRolePrivilege> userRoles = userRoleDao.getAllUserRoles();

        //find the one we have to update
        UserRolePrivilege foundRolePriv = null;
        {
            for( final UserRolePrivilege urp : userRoles )
            {
                if( urp.getUserRoleType().getKey().equals(vo.getUserRole()) )
                {
                    foundRolePriv = urp;
                    break;
                }
            }
        }

        if( null == foundRolePriv )
        {
            throw new RuntimeException("Unexpected SETE error: could not find UserRolePrivilege with key='" + vo.getUserRole() + "'");
        }

        //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
View Full Code Here

Examples of org.sete.domain.UserRolePrivilege

    }

    private void createUserRolePrivileges(UserRoleType.Key roleKey,
                                          Map<PrivilegeActionType.Key, List<UserPrivilegeType.Key>> auths) {

        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);
        baseDao.saveOrUpdate(p);
    }
View Full Code Here

Examples of org.sete.domain.UserRolePrivilege

        user1.setFirstName("Johnny");
        user1.setLastName("Mohseni");
        user1.setLoginName("Johnny");
        user1.setPassword("sete");
        Set<UserRolePrivilege> urps = new HashSet<UserRolePrivilege>();
        UserRolePrivilege urp = new UserRolePrivilege();
        urp.setUserRoleType(TypeUtil.forKey(UserRoleType.class, "student"));
        urps.add(urp);
        user1.setUserRolePrivileges(urps);
              
        SeteUser user2 = new SeteUser();
        user2.setFirstName("Jason");
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.