You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ftpserver-users@mina.apache.org by "ftpserver-users@developer.gb.com" <ft...@developer.gb.com> on 2010/07/26 17:21:36 UTC
How do I set write permission for a user programatically?
Hi Guys
I'm trying to run the ftp server embedded - so far so good - thanks!
When I connect I cannot write a file to the server. I get permission denied.
I noticed that in the users.properties file there is a property for write permission:
ftpserver.user.unittest.writepermission=false
If I set this to 'true' ( making sure I don't save the user in the code) I can write. Is there a way to do this programatically?
This is my java code to create the user (from your example):
UserManager userManager = userManagerFactory.createUserManager();
BaseUser user = new BaseUser();
user.setName("unittest");
user.setPassword("unittest");
user.setHomeDirectory(userHome.getAbsolutePath());
// userManager.save(user);
What I would guess is that there would be a method for me to set the write permission:
user.setWritePermission(true);
but I can't see anything.
I see there are methods for setting 'AuthorizationRequests' but I can't find any examples of how to use it.
Any help would be gratefully received.
Cheers
Allan
Re: How do I set write permission for a user programatically?
Posted by "ftpserver-users@developer.gb.com" <ft...@developer.gb.com>.
Yes, that's a great help. It works now. Thanks!
Allan
On 27 Jul 2010, at 21:53, Frank van der Kleij wrote:
>
>
>
> You should use the Authority and WritePermission classes:
>
>
>
> List<Authority> authorities = new ArrayList<Authority>();
>
> authorities.add(new WritePermission());
>
> user.setAuthorities(authorities);
>
> I hope this helps,
>
> Frank
>
> _________________________________________________________________
> New Windows 7: Find the right PC for you. Learn more.
> http://windows.microsoft.com/shop
RE: How do I set write permission for a user programatically?
Posted by Frank van der Kleij <kl...@hotmail.com>.
You should use the Authority and WritePermission classes:
List<Authority> authorities = new ArrayList<Authority>();
authorities.add(new WritePermission());
user.setAuthorities(authorities);
I hope this helps,
Frank
_________________________________________________________________
New Windows 7: Find the right PC for you. Learn more.
http://windows.microsoft.com/shop