• If you need help or want to discuss things, you now can also join us on our Discord Server!
  • A first preview of the unlimited version of SinusBot can be found in the Upcoming Changes thread. A version for Windows will follow, but we don't have a release date, yet.

EN Set user privileges using api

Status
Not open for further replies.

Mustafa

Member
Hey guys,

i want to give some privileges to a user, but i don't know how privileges work, i mean if i want to give to user the start/stop bot permissions, how i am going to do this ?
i tried to do like;
$sinusbot->addUser("test","password","1100110");

but it didn't work.
i am waiting for your helps, thx.
 

Yop

Member
Hi,

Here is a PHP API documentation thanks to @Raphraph.

Give a look at this function : public function updateUser($userId, $password = NULL, $tsuid = NULL, $tsgid = NULL, $privileges = NULL) {}.

$sinusbot->updateUser($userId, NULL, NULL, NULL, 1100110);

I didn't test that, but I guess it should work.
 

Mustafa

Member
it isn't work like that, when i look network of sinusbot web panel(with all privilages);

{"id":"1ab6821d-a13d-4a01-a760-f64fb4934541","tsuid":null,"tsgid":null,"locked":0,"username":"test","passwordTimestamp":null,"created":"2016-02-07T10:35:01.185248905+02:00","createdBy":"26a29f94-51a1-4738-a4af-daa2aa11d0b7","lastchange":"2016-02-07T10:35:45.969957464+02:00","lastchangeBy":"26a29f94-51a1-4738-a4af-daa2aa11d0b7","privileges":258989,"isAdmin":0,"lastLogin":null}

any other idea ?
 

Yop

Member
Alright, though you had it correct on that point.

Here's what I just found :
$scope.PRIV_LOGIN = 1, $scope.PRIV_LIST_FILE = 2, $scope.PRIV_UPLOAD_FILE = 4, $scope.PRIV_DELETE_FILE = 8, $scope.PRIV_EDIT_FILE = 16, $scope.PRIV_CREATE_PLAYLIST = 32, $scope.PRIV_DELETE_PLAYLIST = 64, $scope.PRIV_ADDTO_PLAYLIST = 128, $scope.PRIV_STARTSTOP = 256, $scope.PRIV_EDITUSERS = 512, $scope.PRIV_CHANGENICK = 1024, $scope.PRIV_BROADCAST = 2048, $scope.PRIV_PLAYBACK = 4096, $scope.PRIV_ENQUEUE = 8192, $scope.PRIV_ENQUEUENEXT = 16384, $scope.PRIV_EDITBOT = 65536, $scope.PRIV_EDITINSTANCE = 131072

Looks like you just have to do an addition with the privileges you want.
 
Status
Not open for further replies.
Top