Search the FirstSpirit Knowledge Base
Hi All,
I have to provide the server admin roles via First Spirt access api.
I tried with the setAdminMode(true), but unfortunately it is not assigning the server admin permission to the user.
user.setAdminMode(true);
Could you please help us on this?
Version : 5.1.507
Thank you!
Hi Kavin,
did you checked this one?
UserStorage.setUser(user); (Write back a user to server.)?
Regards,
Marcel
Dear Marcel Liebgott,
we tried the below code to remove the user from admin, but the changes was not reflected,
user.setAdminMode(false);
connection.getService(AdminService.class).getProjectStorage().setUser(user);
Thank you!
Hi Kavin,
connection.getService(AdminService.class).getUserStorage().setUser(user);
not "getProjectStorage()"
Regard,
Marcel
Hi Marcel Liebgott,
Sorry, I have mentioned the wrong code in previous comment.
The code which I am trying is below one.
UserStorage userstorage=fsConnection.getService(AdminService.class).getUserStorage();
User user=userstorage.getUserByLogin("test");
user.setAdminMode(true);
userstorage.setUser(user);
But I am getting the exception
java.lang.SecurityException: User 'test (test)' is not a server admin
Thank you!
Hi Kavin,
this is correct - the api means:
Enable admin mode for this user with extended permissions. Admin mode is enabled by default if the user is a
server admin
, but may be explicity switched off in some environments.
Regards,
Marcel
Thank you Marcel Liebgott,
As per the api documentation, only server admin's can switch to Admin mode.
boolean isServerAdmin()
Returns true
if this user is the super admin or a member of a server admin group. Only server admins are allowed to switch to admin mode
.
so, how we can promote the user as ServerAdmin.
What is the difference between AdminMode and ServerAdmin?
Hi Kavin,
you can set a user as server admin in the "ServerManager".
The difference between "Server Admin" and "Admin Mode" is that the Server Admin has specific permissions to edit some server properties (in the sever manager)
Regards,
Marcel
HI Kavin,
no - i didn't found a public way let's wait for e-spirit support
Regards,
Marcel