kavin
I'm new here

How to assign the server admin via First Spirt access api?

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!

0 Kudos
11 Replies
MarsDD
Occasional Observer

Hi Kavin,

did you checked this one?

UserStorage.setUser(user); (Write back a user to server.)?

Regards,

Marcel

0 Kudos

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!

0 Kudos
MarsDD
Occasional Observer

Hi Kavin,

connection.getService(AdminService.class).getUserStorage().setUser(user);

not "getProjectStorage()"

Regard,

Marcel

0 Kudos

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!

0 Kudos
MarsDD
Occasional Observer

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 aserver admin, but may be explicity switched off in some environments.

Regards,

Marcel

0 Kudos

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?


0 Kudos
MarsDD
Occasional Observer

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

0 Kudos

Hi Marcel Liebgott,

Is it possible to set the user as "Server admin" from API?

Thank you!

0 Kudos
MarsDD
Occasional Observer

HI Kavin,

no - i didn't found a public way Smiley Wink let's wait for e-spirit support

Regards,

Marcel

0 Kudos