org.apache.ftpserver.usermanager.impl.TransferRatePermission Java Examples
The following examples show how to use
org.apache.ftpserver.usermanager.impl.TransferRatePermission.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: StorageServerTools.java From o2oa with GNU Affero General Public License v3.0 | 6 votes |
private static UserManager concreteUserManager(List<Account> list) throws Exception { List<BaseUser> users = new ArrayList<>(); for (Account o : list) { BaseUser user = new BaseUser(); user.setEnabled(true); user.setName(o.getUsername()); String password = o.getPassword(); if (StringUtils.isEmpty(password)) { password = Config.token().getPassword(); } user.setPassword(password); File file = new File(Config.base(), "local/repository/storage/" + o.getUsername()); FileUtils.forceMkdir(file); user.setHomeDirectory(file.getAbsolutePath()); user.setMaxIdleTime(0); List<Authority> authorities = new ArrayList<Authority>(); authorities.add(new WritePermission()); authorities.add(new ConcurrentLoginPermission(0, 0)); authorities.add(new TransferRatePermission(0, 0)); user.setAuthorities(authorities); users.add(user); } StorageUserManager userManager = new StorageUserManager(users); return userManager; }
Example #2
Source File: FtpUser.java From ProjectX with Apache License 2.0 | 6 votes |
private FtpUser(String name, String password, FtpFileSystemViewAdapter adapter) { if (TextUtils.isEmpty(name)) throw new RuntimeException("User name can not be empty!"); mName = name; mPassword = password; mAdapter = adapter; mAdapter.onAttached(this); // 写入权限 mAuthorities.add(new WritePermission()); // 上传下载数目权限 mAuthorities.add(new TransferRatePermission(0, 0)); // 登录权限 mAuthorities.add(new ConcurrentLoginPermission(10, 10)); }
Example #3
Source File: FtpTestSupport.java From spring-cloud-stream-app-starters with Apache License 2.0 | 5 votes |
private TestUserManager(String homeDirectory) { this.testUser = new BaseUser(); this.testUser.setAuthorities(Arrays.asList(new ConcurrentLoginPermission(1024, 1024), new WritePermission(), new TransferRatePermission(1024, 1024))); this.testUser.setHomeDirectory(homeDirectory); this.testUser.setName("TEST_USER"); }
Example #4
Source File: DHuSFtpUserManager.java From DataHubSystem with GNU Affero General Public License v3.0 | 5 votes |
@Override public User getUserByName(final String name) throws FtpException { if (name == null) return null; fr.gael.dhus.database.object.User u = userService.getUserNoCheck (name); if (u==null) return null; BaseUser user = new BaseUser(); user.setName(u.getUsername()); user.setPassword(u.getPassword()); user.setEnabled( u.isEnabled() && u.isAccountNonExpired() && u.isAccountNonLocked() && u.isCredentialsNonExpired() && !u.isDeleted()); user.setHomeDirectory("/"); List<Authority> authorities = new ArrayList<>(); authorities.add(new WritePermission ()); // No special limit int maxLogin = 0; int maxLoginPerIP = 0; authorities.add(new ConcurrentLoginPermission(maxLogin, maxLoginPerIP)); int uploadRate = 0; int downloadRate = 0; authorities.add(new TransferRatePermission(downloadRate, uploadRate)); user.setAuthorities(authorities); user.setMaxIdleTime(1000); return user; }