Cannot add a role to user [message #1779873] |
Mon, 15 January 2018 03:06  |
Eclipse User |
|
|
|
I want to add a role to user by api, i use the api :
1. POST /authentication/user ----- the admin user login
2. GET /_/users?name={other_user_name}&offset=0&limit=50 ----- get other user id {userId}
3. GET /_/accessinfos?userId={userId}&offset=0&limit=50 ------get accessinfos id {accessInfoId}
4. GET /_/roles?offset=0&limit=50 ------get role id {roleId}
5. POST /_/accessinfos/{accessInfoId}/roles.
body:
{
"roleId": "{roleId}",
"accessInfoId": "{accessInfoId}",
"scopeId": "_"
}
everything is ok, but at 5 step the server response:
<!DOCTYPE html>
<html>
<head>
<title>Kapua</title>
</head>
<body>
<h1>Kapua</h1>
<p>Error 403: The request was a valid request, but the server is refusing to respond to it.</p>
</body>
</html>
i can add role to user in console and delect it role by api, but cannot add it. how can i do?
[Updated on: Mon, 15 January 2018 05:18] by Moderator
|
|
|
|
Re: Cannot add a role to user [message #1779884 is a reply to message #1779881] |
Mon, 15 January 2018 05:16   |
Eclipse User |
|
|
|
Milan Ggg wrote on Mon, 15 January 2018 10:00Hello.
Maybe you don't have right permissions for your user to get roles info.
Can you try to do authentication with kapua-sys / kapua-password credentials, and try again?
And if I understood you correctly, you want to add a role tu user from api, not console? I am not sure if that is possible.
Regards,
Milan
Comtrade Digital services
I have a problem at 5 step.
I sure have permissions ,because i use save admin user in console can add role to other user. I also can delete it from api, but cannot add.
yes, I want to add a role to user from api, i think it is possible, just the api not work.
[Updated on: Mon, 15 January 2018 05:19] by Moderator
|
|
|
|
Re: Cannot add a role to user [message #1808755 is a reply to message #1779953] |
Mon, 01 July 2019 05:28  |
Eclipse User |
|
|
|
Hi Lin,
In the body you need to provide the correct `scopeId`.
In the request URL the scope id is `_` which is a shortcut to the logged user's scope, but that shortcut will not work in the body of the request.
Regards,
- Alberto
|
|
|
Powered by
FUDForum. Page generated in 0.05483 seconds