Package info.jtrac.domain

Examples of info.jtrac.domain.UserSpaceRole


        assertEquals(1, gas.length);       
        assertEquals("ROLE_TEST:TEST", gas[0].getAuthority());
       
        List<UserSpaceRole> userSpaceRoles = jtrac.findUserRolesForSpace(space.getId());
        assertEquals(1, userSpaceRoles.size());
        UserSpaceRole usr = userSpaceRoles.get(0);
        assertEquals("test", usr.getUser().getLoginName());
        assertEquals("ROLE_TEST", usr.getRoleKey());
       
        List<User> users = jtrac.findUsersForUser(u1);
        assertEquals(1, users.size());
       
        List<User> users2 = jtrac.findUsersForSpace(space.getId());
View Full Code Here


        User user = new User();
        user.setLoginName("test");
        user.addSpaceWithRole(space, "ROLE_ADMIN");
        jtrac.storeUser(user);
        long id = jdbcTemplate.queryForLong("select id from user_space_roles where space_id = " + spaceId);
        UserSpaceRole usr = jtrac.loadUserSpaceRole(id);
        assertEquals(spaceId, usr.getSpace().getId());
        jtrac.removeUserSpaceRole(usr);
        setComplete();
        endTransaction();       
        assertEquals(0, jdbcTemplate.queryForInt("select count(0) from user_space_roles where space_id = " + spaceId));
        cleanDatabase();
View Full Code Here

            boolean isSuperUser = superUsers.contains(user);
            for(String roleKey : roleKeys) {
                if(isSuperUser && Role.isAdmin(roleKey)) {
                    continue;
                }
                UserSpaceRole temp = new UserSpaceRole(user, space, roleKey);
                if(!allocated.contains(temp)) {
                    notFullyAllocated.add(user);
                    break;
                }
            }
View Full Code Here

            processed.add(space);
            for(String roleKey : space.getMetadata().getAllRoleKeys()) {
                if(isSuperUser && Role.isAdmin(roleKey)) {
                    continue;
                }
                UserSpaceRole temp = new UserSpaceRole(user, space, roleKey);
                if(!allocated.contains(temp)) {
                    notFullyAllocated.add(space);
                    break;
                }
            }
View Full Code Here

   
    public RoleDeAllocatePanel(String id, List<UserSpaceRole> userSpaceRoles) {
        super(id);
        add(new ListView("roleKeys", userSpaceRoles) {                           
            protected void populateItem(ListItem roleKeyItem) {
                final UserSpaceRole usr = (UserSpaceRole) roleKeyItem.getModelObject();
                roleKeyItem.add(new Label("roleKey", usr.getRoleKey()));
                Button deallocate = new Button("deallocate") {
                    @Override
                    public void onSubmit() {
                        // avoid lazy loading problem
                        UserSpaceRole temp = getJtrac().loadUserSpaceRole(usr.getId());
                        if(temp == null) {
                            // very rare chance that this is a user in "guest mode"                           
                            return;
                        }
                        getJtrac().removeUserSpaceRole(temp);                                                                                     
                        JtracSession.get().refreshPrincipalIfSameAs(temp.getUser());
                        // TODO have some nice interface for this
                        if(getPage() instanceof UserAllocatePage) {
                            UserAllocatePage page = (UserAllocatePage) getPage();
                            setResponsePage(new UserAllocatePage(page.getUserId(), page.getPrevious()));
                        } else if(getPage() instanceof SpaceAllocatePage) {
View Full Code Here

            table.add(hideLogged);
            table.add(hideAssigned);

            table.add(new ListView("dashboardRows", spaceRoles) {
                protected void populateItem(final ListItem listItem) {
                    UserSpaceRole usr = (UserSpaceRole) listItem.getModelObject();
                    Counts counts = countsHolder.getCounts().get(usr.getSpace().getId());
                    if (counts == null) {
                        counts = new Counts(false); // this can happen if fresh space
                    }
                    DashboardRowPanel dashboardRow = new DashboardRowPanel("dashboardRow", usr, counts);                   
                    listItem.add(dashboardRow);
View Full Code Here

TOP

Related Classes of info.jtrac.domain.UserSpaceRole

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.