Package org.joget.directory.model

Examples of org.joget.directory.model.Group


    public Collection<User> getUserByGroupId(String groupId) {
        return getUserDao().getUsers(null, null, null, null, groupId, null, null, "username", false, null, null);
    }

    public Collection<User> getUserByGroupName(String groupName) {
        Group group = getGroupDao().getGroupByName(groupName);
        if (group != null) {
            return getUserDao().getUsers(null, null, null, null, group.getId(), null, null, "username", false, null, null);
        }
        return null;
    }
View Full Code Here


    public Long getTotalUsers() {
        return getUserDao().getTotalUsers(null, null, null, null, null, null, null);
    }

    public boolean isUserInGroup(String username, String groupName) {
        Group group = getGroupDao().getGroupByName(groupName);

        if (group != null) {
            Collection<User> users = getUserDao().getUsers(username, null, null, null, group.getId(), null, null, null, null, null, null);

            if (users != null) {
                for (User user : users) {
                    if (user.getUsername().equals(username)) {
                        return true;
View Full Code Here

    }

    public Boolean assignUserToGroup(String userId, String groupId) {
        try {
            User user = getUserById(userId);
            Group group = getGroupDao().getGroup(groupId);
            if (user != null && group != null) {
                user.getGroups().add(group);
                saveOrUpdate("User", user);
                return true;
            }
View Full Code Here

    }

    public Boolean unassignUserFromGroup(String userId, String groupId) {
        try {
            User user = getUserById(userId);
            Group group = getGroupDao().getGroup(groupId);
            if (user != null && group != null) {
                user.getGroups().remove(group);
                saveOrUpdate("User", user);
                return true;
            }
View Full Code Here

        }
    }

    public Boolean deleteGroup(String id) {
        try {
            Group group = getGroup(id);
            if (group != null && group.getUsers() != null) {
                group.getUsers().clear();
            }
            delete("Group", group);
            return true;
        } catch (Exception e) {
            LogUtil.error(GroupDaoImpl.class.getName(), e, "Delete Group Error!");
View Full Code Here

        }
    }

    public Group getGroupByName(String name) {
        try {
            Group group = new Group();
            group.setName(name);
            List groups = findByExample("Group", group);

            if (groups.size() > 0) {
                return (Group) groups.get(0);
            }
View Full Code Here

        User user = directoryManager.getUserByUsername(TEST_USER);
        Assert.isTrue(TEST_USER.equals(user.getFirstName()));

        // verify group
        LogUtil.info(getClass().getName(), "testUsersAndGroups: verify group");
        Group group = null;
        Collection<Group> groupList = directoryManager.getGroupByUsername(TEST_USER);
        if (!groupList.isEmpty()) {
            group = groupList.iterator().next();
        }
        Assert.isTrue(group != null && TEST_GROUP.equals(group.getId()));

        // unassign user from group
        LogUtil.info(getClass().getName(), "testUsersAndGroups: unassign user from group");
        userDao.unassignUserFromGroup(TEST_USER, TEST_GROUP);
        groupList = directoryManager.getGroupByUsername(TEST_USER);
View Full Code Here

        departmentDao.addDepartment(department);
    }

    protected void addGroup(String id) {
        LogUtil.info(getClass().getName(), "addGroup");
        Group group = new Group();
        group.setId(id);
        group.setName(id);
        group.setDescription(id);
        groupDao.addGroup(group);
    }
View Full Code Here

    public String[] getAllUsersForGroups(WMSessionHandle shandle, String[] groupNames) throws Exception {
        Collection userList = new HashSet();
        if (groupNames != null) {
            for (int i = 0; i < groupNames.length; i++) {
                Group group = getGroupByName(groupNames[i]);
                if (group != null) {
                    Collection<User> groupUsers = directoryManager.getUserByGroupId(group.getId());
                    for (User user : groupUsers) {
                        userList.add(user.getUsername());
                    }
                }
            }
View Full Code Here

    @RequestMapping("/console/directory/group/create")
    public String consoleGroupCreate(ModelMap model) {
        Collection<Organization> organizations = organizationDao.getOrganizationsByFilter(null, "name", false, null, null);
        model.addAttribute("organizations", organizations);
        model.addAttribute("group", new Group());
        return "console/directory/groupCreate";
    }
View Full Code Here

TOP

Related Classes of org.joget.directory.model.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.