@Override public String getOwnerName() { logger.trace("[{}] getOwnerName()", name); return user.getName(); }
@Override public String getGroupName() { logger.trace("[{}] getGroupName()", name); return user.getName(); }
@Override public String getGroupName() { logger.trace("[{}] getGroupName()", name); return user.getName(); } }
@Override public String getGroupName() { logger.trace("[{}] getGroupName()", name); return user.getName(); } }
@Override public String getOwnerName() { logger.trace("[{}] getOwnerName()", name); return user.getName(); }
@Override public String getOwnerName() { logger.trace("[{}] getOwnerName()", name); return user.getName(); }
@Override public String getGroupName() { logger.trace("[{}] getGroupName()", name); return user.getName(); } }
@Override public String getOwnerName() { logger.trace("[{}] getOwnerName()", name); return user.getName(); }
@Override public void save(User user) throws FtpException { users.put(user.getName(), user); }
/** * Get the login number for the specific user */ public synchronized int getCurrentUserLoginNumber(final User user) { UserLogins userLogins = userLoginTable.get(user.getName()); if (userLogins == null) {// not found the login user's statistics info return 0; } else { return userLogins.totalLogins.get(); } }
/** * Create and register a temporary file in the home directory of the given user. The created file is empty. * * @param user * The owner of the file * @return The name of temporary file created, relative to the user home directory. * @throws IOException * The temporary file can not be created */ public String registerTempFile(final User user) throws IOException { final File userHomeDirectory = new File(user.getHomeDirectory()); final File tempFile = File.createTempFile(user.getName(), ".tmp", userHomeDirectory); return userHomeDirectory.toURI().relativize(tempFile.toURI()).toString(); }
/** * Get the login number for the specific user from the ipAddress * * @param user * login user account * @param ipAddress * the ip address of the remote user */ public synchronized int getCurrentUserLoginNumber(final User user, final InetAddress ipAddress) { UserLogins userLogins = userLoginTable.get(user.getName()); if (userLogins == null) {// not found the login user's statistics info return 0; } else { return userLogins.loginsFromInetAddress(ipAddress).get(); } }
/** * Create and register a temporary file in the home directory of the given user. The created file is empty. The * created file will have the given extension. * * @param user * The owner of the file * @param extension * The extension of the file to create. The '.' delimiting the base name and the extension will be * automatically added. * @return The name of temporary file created, relative to the user home directory. * @throws IOException * The temporary file can not be created */ public String registerTempFile(final User user, final String extension) throws IOException { final File userHomeDirectory = new File(user.getHomeDirectory()); final File tempFile = File.createTempFile(user.getName(), "." + extension, userHomeDirectory); return userHomeDirectory.toURI().relativize(tempFile.toURI()).toString(); }
@Override public FileSystemView createFileSystemView(User user) { final String home = user.getHomeDirectory(); final String owner = user.getName(); final String group = user.getName(); final int streamSize = FTPFile.DEFAULT_SIZE; synchronized (this) { if (mViews.isEmpty()) { return new FTPFileSystemView(home, owner, group, streamSize); } else { final FTPFileSystemView view = mViews.remove(0); view.init(home, owner, group, streamSize); return view; } } }
private UserDetails user(User ftpUser) { String username = ftpUser.getName(); String password = ftpUser.getPassword(); boolean isEnabled = ftpUser.getEnabled(); GrantedAuthority[] authorities = new GrantedAuthority[0]; boolean accountNonExpired = true; boolean credentialsNonExpired = true; boolean accountNonLocked = true; UserDetails userDetails = new org.springframework.security.core.userdetails.User(username, password, isEnabled, accountNonExpired, credentialsNonExpired, accountNonLocked, Arrays.asList(authorities)); return userDetails; }
/** * Observer logout notification. */ private void notifyLogout(final FtpIoSession session) { StatisticsObserver observer = this.observer; if (observer != null) { // is anonymous login User user = session.getUser(); boolean anonymous = false; if (user != null) { String login = user.getName(); anonymous = (login != null) && login.equals("anonymous"); } observer.notifyLogout(anonymous); } }
/** * Observer login notification. */ private void notifyLogin(final FtpIoSession session) { StatisticsObserver observer = this.observer; if (observer != null) { // is anonymous login User user = session.getUser(); boolean anonymous = false; if (user != null) { String login = user.getName(); anonymous = (login != null) && login.equals("anonymous"); } observer.notifyLogin(anonymous); } }
/** * Copy constructor. */ public BaseUser(User user) { name = user.getName(); password = user.getPassword(); authorities = user.getAuthorities(); maxIdleTimeSec = user.getMaxIdleTime(); homeDir = user.getHomeDirectory(); isEnabled = user.getEnabled(); }
/** * Copy constructor. */ public HdfsUser(User user) { name = user.getName(); password = user.getPassword(); authorities = user.getAuthorities(); maxIdleTimeSec = user.getMaxIdleTime(); homeDir = user.getHomeDirectory(); isEnabled = user.getEnabled(); }
static FTPUser from(User user) { final String name = user.getName(); final String password = user.getPassword(); final String homeDirectory = user.getHomeDirectory(); final boolean enable = user.getEnabled(); final int idleSec = user.getMaxIdleTime(); boolean hasWritePermission = false; List<? extends Authority> authorities = user.getAuthorities(); if (authorities != null) { for (Authority authority : authorities) { if (authority instanceof WritePermission) { hasWritePermission = true; break; } } } return new FTPUser(name, password, homeDirectory, false, enable, idleSec, hasWritePermission, 0, 0, 10, 10); }