Package org.osgi.service.useradmin

Examples of org.osgi.service.useradmin.Group.addMember()


        Role userAnyone = m_userAdmin.getRole(Role.USER_ANYONE);
        User user1 = (User) m_userAdmin.createRole("user1", Role.USER);
        Group group1 = (Group) m_userAdmin.createRole("group1", Role.GROUP);

        assertTrue(group1.addRequiredMember(user1));
        assertTrue(group1.addMember(userAnyone));
       
        Authorization auth = m_userAdmin.getAuthorization(user1);
        assertNotNull(auth);
       
        assertTrue(auth.hasRole("group1"));
View Full Code Here


        try
        {
            if ("addMember".equals(action)) { //$NON-NLS-1$
                final Role xrole = userAdmin.getRole(role);
                final Group xgroup = (Group) userAdmin.getRole(group);
                xgroup.addMember(xrole);
                toJSON(jw, xgroup, false);
            }
            else if ("addRequiredMember".equals(action)) { //$NON-NLS-1$
                final Role xrole = userAdmin.getRole(role);
                final Group xgroup = (Group) userAdmin.getRole(group);
View Full Code Here

        // Fill the user admin with some data...
        User testUser = (User) userAdmin.createRole(userName, Role.USER);
        testUser.getProperties().put("key", "value");

        Group testGroup = (Group) userAdmin.createRole(groupName, Role.GROUP);
        testGroup.addMember(testUser);

        // Stop the file store...
        fileStoreBundle.stop();

        // retrieve the useradmin again...
View Full Code Here

        // Fill the user admin with some data...
        User testUser = (User) userAdmin.createRole(userName, Role.USER);
        testUser.getProperties().put("key", "value");

        Group testGroup = (Group) userAdmin.createRole(groupName, Role.GROUP);
        testGroup.addMember(testUser);

        // Stop the file store...
        fileStoreBundle.stop();

        Bundle userAdminBundle = findBundle(ORG_APACHE_FELIX_USERADMIN);
View Full Code Here

        assertNotNull(user);

        Group group = (Group) ua.createRole("group1", Role.GROUP);
        assertNotNull(group);

        group.addMember(user);
        group.addRequiredMember(ua.getRole(Role.USER_ANYONE));

        // Stop the file store; should persist the two roles...
        fileStoreBundle.stop();
View Full Code Here

            throw new UserAlreadyExistsException(username);
        }
        User newUser = (User) newRole;
        newUser.getProperties().put("username", username);
        newUser.getCredentials().put("password", password);
        group.addMember(newUser);
    }

    public void storeUserDTO(UserDTO userDTO) throws UserNotFoundException, GroupNotFoundException, UserAlreadyExistsException {
        if (userDTO.isUsernameChanged()) {
            editUsername(userDTO);
View Full Code Here

        }
        if (user == null) {
            throw new UserNotFoundException(username);
        }
        getGroup(user).removeMember(user);
        newGroup.addMember(user);
    }

    @Override
    public void removeUser(UserDTO userDTO) throws UserNotFoundException {
        String username = userDTO.getPreviousUsername();
View Full Code Here

        Group group = (Group) m_userAdmin.getRole("TestGroup");
        if (newRole != null && group != null) {
            newUser = (User) newRole;
            newUser.getProperties().put("username", "u");
            newUser.getCredentials().put("password", "p");
            group.addMember(newUser);
        }
        assertEquals(group, m_userEditor.getGroup(newUser));
        m_userAdmin.removeRole("u");
    }
View Full Code Here

        Group group = (Group) m_userAdmin.getRole("TestGroup");
        if (newRole != null && group != null) {
            newUser = (User) newRole;
            newUser.getProperties().put("username", "u");
            newUser.getCredentials().put("password", "p");
            group.addMember(newUser);
        }
        assertEquals("Testuser", m_userEditor.getUser("u").getName());
    }
}
View Full Code Here

            Group g = (Group) m_userAdmin.getRole(groupName);
            if (g == null) {
                m_log.log(LogService.LOG_WARNING, "Cannot add user " + role.getName() + " to group " + groupName + ", because the group does not exist.");
                continue;
            }
            g.addMember(r);
        }
    }

    private void clearDictionary(Dictionary dict) {
        Enumeration i = dict.keys();
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.