Search in sources :

Example 1 with FtpUser

use of ddf.catalog.ftp.user.FtpUser in project ddf by codice.

the class UserManagerImpl method createUser.

/**
     * @param userName name of the user being authenticated
     * @param subject  {@link Subject} of the user
     * @return {@link FtpUser}
     */
protected FtpUser createUser(String userName, Subject subject) {
    FtpUser user = new FtpUser();
    user.setName(userName);
    user.setEnabled(true);
    user.setHomeDirectory(uploadDirectory);
    List<Authority> authorities = new ArrayList<>();
    authorities.add(new WritePermission());
    authorities.add(new ConcurrentLoginPermission(0, 0));
    authorities.add(new TransferRatePermission(0, 0));
    user.setAuthorities(authorities);
    user.setMaxIdleTime(MAX_IDLE_TIME_SECONDS);
    user.setSubject(subject);
    setAdmin(user);
    save(user);
    return user;
}
Also used : FtpUser(ddf.catalog.ftp.user.FtpUser) Authority(org.apache.ftpserver.ftplet.Authority) ConcurrentLoginPermission(org.apache.ftpserver.usermanager.impl.ConcurrentLoginPermission) ArrayList(java.util.ArrayList) TransferRatePermission(org.apache.ftpserver.usermanager.impl.TransferRatePermission) WritePermission(org.apache.ftpserver.usermanager.impl.WritePermission)

Aggregations

FtpUser (ddf.catalog.ftp.user.FtpUser)1 ArrayList (java.util.ArrayList)1 Authority (org.apache.ftpserver.ftplet.Authority)1 ConcurrentLoginPermission (org.apache.ftpserver.usermanager.impl.ConcurrentLoginPermission)1 TransferRatePermission (org.apache.ftpserver.usermanager.impl.TransferRatePermission)1 WritePermission (org.apache.ftpserver.usermanager.impl.WritePermission)1