Package com.javaeye.user

Examples of com.javaeye.user.Group


       
    }
   
    public String intercept(ActionInvocation invocation) throws Exception {
        UserManager userManager = (UserManager) Application.getInstance().getContainer().getComponent(UserManager.class);
        Group adminGroup = userManager.getGroup(SecurityService.ADMIN);
        if(adminGroup != null && adminGroup.getUsers().size() > 0) {
            return "setupDone";
        }else{
            return invocation.invoke();
        }
    }
View Full Code Here


public class CreateAdminAccount extends BaseSetupAction {
    private User admin;
    private UserManager userManager;

    public String execute() throws Exception {
        Group adminGroup = getAdminGroup();
        admin.addToGroup(adminGroup);
       
        try {
            userManager.store(admin);
        } catch (DuplicatePartyException e) {
View Full Code Here

        }
        return SUCCESS;
    }

    private Group getAdminGroup() throws DuplicatePartyException {
        Group adminGroup = userManager.getGroup(SecurityService.ADMIN);
        if(adminGroup == null){
            adminGroup = userManager.newGroup();
            adminGroup.setName(SecurityService.ADMIN);
            userManager.store(adminGroup);           
        }
        return adminGroup;
    }
View Full Code Here

* @since    2005-3-6
* @version $Revision: 1.1 $
*/
public class CreateGroup extends BaseUserGroupAction {
    public String execute() throws Exception {
        Group group = userManager.newGroup();
        group.setName(getGroupname());
        userManager.store(group);
        return SUCCESS;
    }
View Full Code Here

    protected ApplicationContext getContext() {
        return new ClassPathXmlApplicationContext("com/javaeye/jert/service/test/SecurityServiceTest.xml");
    }
   
    public void testAddRemove() {
        Group group = userManager.newGroup();
        group.setName("test group");
       
        ReportDefinition reportDefinition = getReportDefintion();
       
        ReportPermissionGroup rpg = service.addReportPermissionToGroup(reportDefinition, group);
        assertEquals(group.getName(), rpg.getGroupName());
        assertEquals(reportDefinition, rpg.getReportDefinition());
       
        service.removeReportPermissionFromGroup(reportDefinition, group);
    }
View Full Code Here

    private UserManager userManager;

    /* use permission name as group name, and check the group contains user or not.
     */
    public boolean hasPermission(User user, String permission) {
        Group group = userManager.getGroup(permission);
        return (group != null && group.containsUser(user));
    }
View Full Code Here

        if(hasPermission(user, ADMIN)) return true;
       
        //TODO the user maybe from session, for the LazyLoad issue, have to reload
        List groups = userManager.getUser(user.getName()).getGroups();
        for (Iterator iter = groups.iterator(); iter.hasNext();) {
            Group group = (Group) iter.next();
            if(findReportPermissionByGroup(group).contains(reportDefinition)) return true;
        }
        return false;
    }
View Full Code Here

TOP

Related Classes of com.javaeye.user.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.