Package org.apache.lenya.ac

Examples of org.apache.lenya.ac.Group


    final public void testGetGroups() throws AccessControlException {
        FileUser user = createAndSaveUser("alice", "Alice Wonderland", "alice@wonderland.org",
                "secret");
               
        for (Iterator i = getGroups().values().iterator(); i.hasNext(); ) {
            Group group = (Group) i.next();
            assertTrue(group.contains(user));
        }
    }
View Full Code Here


            new FileUser(configDir, userName, "Alice in Wonderland", "alice@test.com", "secret");

        editorRole.save();
        adminRole.save();

        Group editorGroup = new FileGroup(configDir, editorGroupId);

        //    editorGroup.addRole(editorRole);
        editorGroup.add(user);

        FileGroup adminGroup = new FileGroup(configDir, adminGroupId);

        //    adminGroup.addRole(editorRole);
        //    adminGroup.addRole(adminRole);
        editorGroup.save();
        adminGroup.save();
        adminGroup.add(user);
        user.save();

        FileGroupManager groupManager = null;
        UserType[] userTypes = { FileAccreditableManager.getDefaultUserType() };
        FileUserManager userManager = FileUserManager.instance(configDir, userTypes);
        assertNotNull(userManager);

        groupManager = FileGroupManager.instance(configDir);
        assertNotNull(groupManager);

        Group fetchedGroup = groupManager.getGroup(editorGroupId);
        assertTrue(editorGroup.equals(fetchedGroup));

        fetchedGroup = groupManager.getGroup(adminGroupId);
        assertTrue(adminGroup.equals(fetchedGroup));
    }
View Full Code Here

    /**
     * Tests the removeAllMembers() method.
     */
    public void testRemoveAllMembers() {
        Group group = getGroup();
        Groupable members[] = group.getMembers();
        group.removeAllMembers();
        for (int i = 0; i < members.length; i++) {
            assertFalse(group.contains(members[i]));
        }
    }
View Full Code Here

                    configurationDirectory + "]", e);
            }

            for (int i = 0; i < groups.length; i++) {
                String groupId = groups[i].getValue();
                Group group = manager.getGroup(groupId);

                if (group == null) {
                    throw new ConfigurationException("Couldn't find Group for group name [" + groupId + "]");
                }
               
                if (!group.contains(this)) {
                    group.add(this);
                }

            }
        } else {
            // strange, it should have groups
View Full Code Here

     * @see org.apache.lenya.cms.usecase.AbstractUsecase#doExecute()
     */
    protected void doExecute() throws Exception {
        super.doExecute();

        final Group group = getGroup();
        group.removeAllMembers();

        List groupUsers = (List) getParameter(GROUP_USERS);
        for (Iterator i = groupUsers.iterator(); i.hasNext();) {
            User user = (User) i.next();
            group.add(user);
            user.save();
        }
    }
View Full Code Here

    }
   
    protected Group getGroup() {
        String groupId = getParameterAsString(GroupProfile.ID);
        Group group = getGroupManager().getGroup(groupId);
        if (group == null) {
            throw new RuntimeException("Group [" + groupId + "] not found.");
        }
        return group;
    }
View Full Code Here

                    configurationDirectory + "]", e);
            }

            for (int i = 0; i < groups.length; i++) {
                String groupId = groups[i].getValue();
                Group group = manager.getGroup(groupId);

                if (group == null) {
                    throw new ConfigurationException("Couldn't find Group for group name [" + groupId + "]");
                }
               
                if (!group.contains(this)) {
                    group.add(this);
                }

            }
        } else {
            // strange, it should have groups
View Full Code Here

        Identifiable[] recipients = message.getRecipients();

        for (int i = 0; i < recipients.length; i++) {
            if (recipients[i] instanceof Group) {
                Group group = (Group) recipients[i];
                noDuplicates.addAll(Arrays.asList(group.getMembers()));
            } else {
                noDuplicates.add(recipients[i]);
            }
        }
View Full Code Here

        Identifiable[] recipients = message.getRecipients();

        for (int i = 0; i < recipients.length; i++) {
            if (recipients[i] instanceof Group) {
                Group group = (Group) recipients[i];
                noDuplicates.addAll(Arrays.asList(group.getMembers()));
            } else {
                noDuplicates.add(recipients[i]);
            }
        }
View Full Code Here

       
        this.user.removeFromAllGroups();
       
        List userGroups = (List) getParameter(USER_GROUPS);
        for (Iterator i = userGroups.iterator(); i.hasNext(); ) {
            Group group = (Group) i.next();
            group.add(this.user);
        }
        user.save();
    }
View Full Code Here

TOP

Related Classes of org.apache.lenya.ac.Group

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.