Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Kapua » Cannot add a role to user
Cannot add a role to user [message #1779873] Mon, 15 January 2018 08:06 Go to next message
lin yanghuan is currently offline lin yanghuanFriend
Messages: 17
Registered: August 2017
Junior Member
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 10:18]

Report message to a moderator

Re: Cannot add a role to user [message #1779881 is a reply to message #1779873] Mon, 15 January 2018 10:00 Go to previous messageGo to next message
Milan Ggg is currently offline Milan GggFriend
Messages: 28
Registered: March 2017
Junior Member
Hello.
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
Re: Cannot add a role to user [message #1779884 is a reply to message #1779881] Mon, 15 January 2018 10:16 Go to previous messageGo to next message
lin yanghuan is currently offline lin yanghuanFriend
Messages: 17
Registered: August 2017
Junior Member
Milan Ggg wrote on Mon, 15 January 2018 10:00
Hello.
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 10:19]

Report message to a moderator

Re: Cannot add a role to user [message #1779953 is a reply to message #1779884] Tue, 16 January 2018 07:44 Go to previous messageGo to next message
lin yanghuan is currently offline lin yanghuanFriend
Messages: 17
Registered: August 2017
Junior Member
I look the api's log , every time i post the request it would print
WARN  org.eclipse.kapua.KapuaException - Could not load Exception Messages Bundle for Locale en_US

it is a bug?
Re: Cannot add a role to user [message #1808755 is a reply to message #1779953] Mon, 01 July 2019 09:28 Go to previous message
Alberto Codutti is currently offline Alberto CoduttiFriend
Messages: 23
Registered: June 2019
Junior Member
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
Previous Topic:Jobs in kapua
Next Topic:ETL for KAPUA
Goto Forum:
  


Current Time: Fri Apr 19 21:07:06 GMT 2024

Powered by FUDForum. Page generated in 0.03188 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top