Package cu.ftpd.user

Examples of cu.ftpd.user.User.addGroup()


        if (user.hasPermission(UserPermission.GROUPS) && user.hasPermission(UserPermission.USEREDIT)) {
            try {
                Group g = ServiceManager.getServices().getUserbase().getGroup(parameterList[2]);
                User u = ServiceManager.getServices().getUserbase().getUser(parameterList[1]);
                if (add) {
                    u.addGroup(g.getName()); // must be a member of the group you are adminning
                    u.addGadminForGroup(g.getName());
                } else {
                    u.removeGadminForGroup(g.getName());
                }
                connection.respond("200 Operation completed successfully.");
View Full Code Here


                        }
                    }
                }
                if (group.getSlots() <= numberOfUsersAlreadyInGroup) {
                    User user = addUser(username, password);
                    user.addGroup(groupname);
                    user.setPrimaryGroup(groupname);
                    return user;
                } else {
                    throw new GroupLimitReachedException("slots", group.getName());
                }
View Full Code Here

                } else {
                    throw new GroupLimitReachedException("slots", group.getName());
                }
            } else {
                User user = addUser(username, password);
                user.addGroup(groupname);
                user.setPrimaryGroup(groupname);
                return user;
            }
        }
    }
View Full Code Here

                user.addPermission(Integer.parseInt(value));
            } else if ("delpermission".equals(property)) {
                user.delPermission(Integer.parseInt(value));
            } else if ("autg".equals(property)) {
                // we check that the group exists in the site-command
                user.addGroup(value);
            } else if ("rufg".equals(property)) {
                user.removeGroup(value);
            } else {
                throw new IllegalArgumentException("Tried to find property that does not exist: [" + username + ':' + property + ':' + value + ']');
            }
View Full Code Here

    public void execute(String[] parameterList, Connection connection, User user, FileSystem fs) {
        if (user.hasPermission(UserPermission.GROUPS)) { // gadmins can't add EXISTING users to their groups
            try {
                User u = ServiceManager.getServices().getUserbase().getUser(parameterList[1]);
                ServiceManager.getServices().getUserbase().getGroup(parameterList[2]); // this is done to verify that the group exists
                u.addGroup(parameterList[2]);
                connection.respond("200 sucessfully added user " + parameterList[1] + " to group " + parameterList[2] + '.');
            } catch (NoSuchUserException e) {
                connection.respond("500 " + e.getMessage());
            } catch (NoSuchGroupException e) {
                connection.respond("500 " + e.getMessage());
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.