Package cu.ftpd.user

Examples of cu.ftpd.user.User


        }
    }

    protected boolean currentUserIsGadminForUser(String username, User user) {
        try {
            User u = ServiceManager.getServices().getUserbase().getUser(username);
            //current user is gadmin for any of the groups the specified user is a member of
            for (String gadminGroup : user.getGadminGroups()) { // this is generally a smaller set, so it makes sense to go over that first, since we abort early
                if (u.isMemberOfGroup(gadminGroup)) {
                    return true;
                }
            }
        } catch (NoSuchUserException e) {
            // you can't be the gadmin of a user that doesn't exist
View Full Code Here


        }
    }

    protected boolean currentUserIsGadminForUser(String username, User user) {
        try {
            User u = ServiceManager.getServices().getUserbase().getUser(username);
            //current user is gadmin for any of the groups the specified user is a member of
            for (String gadminGroup : user.getGadminGroups()) { // this is generally a smaller set, so it makes sense to go over that first, since we abort early
                if (u.isMemberOfGroup(gadminGroup)) {
                    return true;
                }
            }
        } catch (NoSuchUserException e) {
            // you can't be the gadmin of a user that doesn't exist
View Full Code Here

        }
    }

    protected boolean currentUserIsGadminForUser(String username, User user) {
        try {
            User u = ServiceManager.getServices().getUserbase().getUser(username);
            //current user is gadmin for any of the groups the specified user is a member of
            for (String gadminGroup : user.getGadminGroups()) { // this is generally a smaller set, so it makes sense to go over that first, since we abort early
                if (u.isMemberOfGroup(gadminGroup)) {
                    return true;
                }
            }
        } catch (NoSuchUserException e) {
            // you can't be the gadmin of a user that doesn't exist
View Full Code Here

        }
    }

    protected boolean currentUserIsGadminForUser(String username, User user) {
        try {
            User u = ServiceManager.getServices().getUserbase().getUser(username);
            //current user is gadmin for any of the groups the specified user is a member of
            for (String gadminGroup : user.getGadminGroups()) { // this is generally a smaller set, so it makes sense to go over that first, since we abort early
                if (u.isMemberOfGroup(gadminGroup)) {
                    return true;
                }
            }
        } catch (NoSuchUserException e) {
            // you can't be the gadmin of a user that doesn't exist
View Full Code Here

        }
    }

    protected boolean currentUserIsGadminForUser(String username, User user) {
        try {
            User u = ServiceManager.getServices().getUserbase().getUser(username);
            //current user is gadmin for any of the groups the specified user is a member of
            for (String gadminGroup : user.getGadminGroups()) { // this is generally a smaller set, so it makes sense to go over that first, since we abort early
                if (u.isMemberOfGroup(gadminGroup)) {
                    return true;
                }
            }
        } catch (NoSuchUserException e) {
            // you can't be the gadmin of a user that doesn't exist
View Full Code Here

            groupname = username.substring(loc+1);
            username = username.substring(0, loc);
            currentUserIsGadminForGroup = user.isGadminForGroup(groupname);
        }
        try {
            User target = ServiceManager.getServices().getUserbase().getUser(username);
            if (!target.isMemberOfGroup(groupname) && groupname != null) {
                connection.respond("500 User " + username + " is not a member of group " + groupname);
                return;
            }
            boolean ok;
            if (hasUsereditPermission) {
                // here we do all the things that can only be done with full USEREDIT permissions
                // NOTE: we keep "site primarygroup" and "site tagline" and "site passwd" as a convenience command for users to change their own information
                if ("logins".equals(property)) {
                    target.setLogins(Integer.parseInt(value));
                    connection.respond("200 Setting 'logins' to " + target.getLogins() + " for user " + target.getUsername());
                } else if ("passwd".equals(property)) {
                    target.passwd(ServiceManager.getServices().getUserbase().createHashedPassword(value));
                    connection.respond("200 changed password for user " + target.getUsername());
                } else if ("suspended".equals(property)) {
                    target.setSuspended(Boolean.parseBoolean(value));
                    connection.respond("200 Setting 'suspended' to " + target.isSuspended() + " for user " + target.getUsername());
                } else if ("hidden".equals(property)) {
                    target.setHidden(Boolean.parseBoolean(value));
                    connection.respond("200 Setting 'hidden' to " + target.isHidden() + " for user " + target.getUsername());
                } else if ("tagline".equals(property)) {
                    target.setTagline(Formatter.join(parameterList, 3, parameterList.length, " "));
                    connection.respond("200 Setting 'tagline' to \"" + target.getTagline() + "\" for user " + target.getUsername());
                } else if ("primarygroup".equals(property)) {
                    if (target.isMemberOfGroup(value)) {
                        target.setPrimaryGroup(value);
                        connection.respond("200 Setting 'primarygroup' to " + target.getPrimaryGroup() + " for user " + target.getUsername());
                    } else {
                        connection.respond("500 User " + target.getUsername() + " is not a member of group " + value);
                    }
                } else if ("leech".equals(property)) {
                    // we don't care about the return value here, it will always succeed if we don't check for availability
                    /*
                    [19:16:49] site change captain leech true
                    [19:16:49] 200 Setting 'leech' to true for user captain
                    [19:17:01] site change captain leech true
                    [19:17:01] 200 Setting 'leech' to true for user captain
                    [19:17:06] site change captain leech false
                    [19:17:06] 200 Setting 'leech' to true for user captain
                    [19:17:13] site change captain leech false
                    [19:17:13] 200 Setting 'leech' to false for user captain


                     */
                    ServiceManager.getServices().getUserbase().setLeechForUser(Boolean.parseBoolean(value), username, groupname, false);
                    connection.respond("200 Setting 'leech' to " + target.hasLeech() + " for user " + target.getUsername());
                } else if ("allotment".equals(property)) {
                    // No need to check for NumberFormatException here, that is done in an outer try
                    final long credits = Formatter.size(value);
                    ServiceManager.getServices().getUserbase().setAllotmentForUser(credits, username, groupname, false);
                    connection.respond("200 Setting 'allotment' to " + credits + " for user " + target.getUsername());
                    // we don't care about the return value here, it will always succeed if we don't check for availability
                } else {
                    help(true, connection, fs);
                }
            } else if (currentUserIsGadminForGroup) {
                if ("leech".equals(property)) {
                    ok = ServiceManager.getServices().getUserbase().setLeechForUser(Boolean.parseBoolean(value), username, groupname, true);
                    if (ok) {
                        connection.respond("200 Setting 'leech' to " + target.hasLeech() + " for user " + target.getUsername() + " in group " + groupname);
                    } else {
                        connection.respond("500- Failed to set 'leech' to true for user " + target.getUsername() + " in group " + groupname);
                        connection.respond("500  because the group uses all its allocated leech slots already");
                    }
                } else if ("allotment".equals(property)) {
                    // No need to check for NumberFormatException here, that is done in an outer try
                    long credits = Formatter.size(value);
                    ok = ServiceManager.getServices().getUserbase().setAllotmentForUser(credits, username, groupname, true);
                    if (ok) {
                        connection.respond("200 Setting 'allotment' to " + credits + " for user " + target.getUsername() + " in group " + groupname);
                    } else {
                        connection.respond("500- Failed to set 'allotment' to " + credits + " for user " + target.getUsername() + " in group " + groupname);
                        connection.respond("500  because the group uses all its allotment slots already, or the allotment was larger than the max allowed allotment");
                    }
                } else {
                    help(true, connection, fs);
                }
View Full Code Here

        }
    }

    protected boolean currentUserIsGadminForUser(String username, User user) {
        try {
            User u = ServiceManager.getServices().getUserbase().getUser(username);
            //current user is gadmin for any of the groups the specified user is a member of
            for (String gadminGroup : user.getGadminGroups()) { // this is generally a smaller set, so it makes sense to go over that first, since we abort early
                if (u.isMemberOfGroup(gadminGroup)) {
                    return true;
                }
            }
        } catch (NoSuchUserException e) {
            // you can't be the gadmin of a user that doesn't exist
View Full Code Here

        }
    }

    protected boolean currentUserIsGadminForUser(String username, User user) {
        try {
            User u = ServiceManager.getServices().getUserbase().getUser(username);
            //current user is gadmin for any of the groups the specified user is a member of
            for (String gadminGroup : user.getGadminGroups()) { // this is generally a smaller set, so it makes sense to go over that first, since we abort early
                if (u.isMemberOfGroup(gadminGroup)) {
                    return true;
                }
            }
        } catch (NoSuchUserException e) {
            // you can't be the gadmin of a user that doesn't exist
View Full Code Here

        }
    }

    protected boolean currentUserIsGadminForUser(String username, User user) {
        try {
            User u = ServiceManager.getServices().getUserbase().getUser(username);
            //current user is gadmin for any of the groups the specified user is a member of
            for (String gadminGroup : user.getGadminGroups()) { // this is generally a smaller set, so it makes sense to go over that first, since we abort early
                if (u.isMemberOfGroup(gadminGroup)) {
                    return true;
                }
            }
        } catch (NoSuchUserException e) {
            // you can't be the gadmin of a user that doesn't exist
View Full Code Here

        }
    }

    protected boolean currentUserIsGadminForUser(String username, User user) {
        try {
            User u = ServiceManager.getServices().getUserbase().getUser(username);
            //current user is gadmin for any of the groups the specified user is a member of
            for (String gadminGroup : user.getGadminGroups()) { // this is generally a smaller set, so it makes sense to go over that first, since we abort early
                if (u.isMemberOfGroup(gadminGroup)) {
                    return true;
                }
            }
        } catch (NoSuchUserException e) {
            // you can't be the gadmin of a user that doesn't exist
View Full Code Here

TOP

Related Classes of cu.ftpd.user.User

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.