Package cu.ftpd.user

Examples of cu.ftpd.user.User


    public void execute(String[] parameterList, Connection connection, User user, FileSystem fs) {
        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.");
            } catch (NoSuchGroupException e) {
                connection.respond("550 " + e.getMessage());
            } catch (NoSuchUserException e) {
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

                    connection.respond(createHeader());
                    connection.respond(String.format(lineFormat, Formatter.getBar(), "User", "Group", "Action", Formatter.getBar()));
                    connection.respond(Formatter.createLine(200));
                }
              for (Connection c : Sort.connections(conns)) {
                    User u = c.getUser();

                    // not listing users that are not logged in might cause problems if people connect and then are orphaned. the site might look empty
                    // but people still can't get in
                    // we will list these connections in xwho (or whatever we'll call it)
                    // so, the NullPointerException we got here was when the connection was being reconnected automatically, and
                    // we did a "site who" before there was a User object available, and thus we got a NullpointerException
                   
                    if (u != null) { // don't list connections where the user hasn't logged in yet
                        if ((u.isHidden() && !user.hasPermission(UserPermission.SEE_HIDDEN)) || !ServiceManager.getServices().getPermissions().canSee(user, u, c.getCurrentDir())) {
                            // hide user if user has the property hidden, or the directory in which the user operates is hidden
                            continue;
                        }
                        if (c.isUploading()) {
                            if (raw) {
                                connection.respond(u.getUsername() + ";" + u.getPrimaryGroup() + ";uploading;" + c.getCurrentSpeed() + ";" + c.getIdleTime() + ";" + escape(c.getLastCommand()));
                            } else {
                                connection.respond(String.format(lineFormat, Formatter.getBar(), u.getUsername(), u.getPrimaryGroup(), c.getLastCommand() + " @ " + Formatter.speedFromKBps(c.getCurrentSpeed()), Formatter.getBar()));
                            }
                        } else if (c.isDownloading()) {
                            if (raw) {
                                connection.respond(u.getUsername() + ";" + u.getPrimaryGroup() + ";downloading;" + c.getCurrentSpeed() + ";" + c.getIdleTime() + ";" + escape(c.getLastCommand()));
                            } else {
                                connection.respond(String.format(lineFormat, Formatter.getBar(), u.getUsername(), u.getPrimaryGroup(), c.getLastCommand() + " @ " + Formatter.speedFromKBps(c.getCurrentSpeed()), Formatter.getBar()));
                            }
                        } else {
                            if (raw) {
                                connection.respond(u.getUsername() + ";" + u.getPrimaryGroup() + ";idle;" + c.getCurrentSpeed() + ";" + c.getIdleTime() + ";" + escape(c.getLastCommand()));
                            } else {
                                connection.respond(String.format(lineFormat, Formatter.getBar(), u.getUsername(), u.getPrimaryGroup(), "idle for " + Formatter.shortDuration(c.getIdleTime()), Formatter.getBar()));
                            }
                        }
                    }
                }
                if (raw) {
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

        connection.respond("200 Password set.");
    }

    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

        random.nextBytes(salt);
        String hashedPassword = PasswordHasher.cuftpdHash(password.toCharArray(), salt);
        return '$' + new String(Hex.bytesToHex(salt)) + '$' + hashedPassword;
    }
    public int authenticate(AuthenticationRequest auth) {
        User user = users.get(auth.getUsername());
        if (user == null) {
            return AuthenticationResponses.NO_SUCH_USER;
        } else if (user.isSuspended()) {
            return AuthenticationResponses.USER_SUSPENDED;
        } else {
            boolean identOk = checkIdent(auth, user);
            if (identOk) {
                return checkPassword(user, auth);
View Full Code Here

        deleteUser(username, true);
    }

    public void deleteUser(String username, boolean propagate) throws NoSuchUserException {
        synchronized(users) {
            User user = users.remove(username);
            if (user == null) {
                throw new NoSuchUserException(username);
            }
            Server.getInstance().kick(username, "deleted");
            File userfile = new File(userdir, username);
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.