User specific data
-
@Danp yes we are testing self service.
Can you elaborate on this? What specific API is the user calling to retrieve this information?
we want to retrieve and perform these > vm list, vm stats, console, actions etc
we do not want to using each user token to access their objects. we want a single point to get the data
-
@irtaza9 I'm not sure if this is currently possible with the REST API.
-
@Danp said in User specific data:
currently possible with the REST API.
can we do this using JSON-RPC?
-
@irtaza9 Yes, I imagine that is what XO is using. Calling
resourceSet.get
will return an array of objects associated with the resource set as well as an array of subjects (users / groups). -
I have two users
test.irtaza
,testirtaza1
in a resource set namedcustomer
. And when login any of the account this is the output ofresourceSet.getAll
login via
test.irtaza
{ "id": -9007199254740984, "jsonrpc": "2.0", "result": [ { "id": "V7Gr0uoqGwE", "ipPools": [], "limits": { "cpus": { "usage": 1 }, "disk": { "usage": 10737418240 }, "memory": { "usage": 4294967296 }, "vms": { "usage": 1 } }, "name": "customer", "objects": [ "d4515c45-71ca-7675-ea70-0fe0a8f7dbe4-7aa32be8-a06c-4ade-8a1d-49e51e03e9d2", "d4515c45-71ca-7675-ea70-0fe0a8f7dbe4-09d6b4cc-dd4b-4619-aacb-01576ccd5b0f", "20e6d987-f8cb-d1b6-2b49-744a87358ae3", "ca780b00-fd77-4a2a-fbb2-6f2859e6b4a7" ], "subjects": [ "78f3286b-f4a1-4ba5-80a4-bda4967d47a8" ], "shareByDefault": false, "tags": [] } ] }
login via
testirtaza1
{ "id": -9007199254740984, "jsonrpc": "2.0", "result": [ { "id": "V7Gr0uoqGwE", "ipPools": [], "limits": { "cpus": { "usage": 2 }, "disk": { "usage": 21474836480 }, "memory": { "usage": 8589934592 }, "vms": { "usage": 2 } }, "name": "customer", "objects": [ "d4515c45-71ca-7675-ea70-0fe0a8f7dbe4-7aa32be8-a06c-4ade-8a1d-49e51e03e9d2", "d4515c45-71ca-7675-ea70-0fe0a8f7dbe4-09d6b4cc-dd4b-4619-aacb-01576ccd5b0f", "20e6d987-f8cb-d1b6-2b49-744a87358ae3", "ca780b00-fd77-4a2a-fbb2-6f2859e6b4a7" ], "subjects": [ "78f3286b-f4a1-4ba5-80a4-bda4967d47a8", "f2858952-b02a-403a-98ca-d94e4cdaa57e" ], "shareByDefault": false, "tags": [] } ] }
is the
array of subjects
are the users andarray of objects
are those things which thesesubjects
have access on?Also
session.signIn
method returns the id of user{ "id": -9007199254740991, "jsonrpc": "2.0", "result": { "id": "f2858952-b02a-403a-98ca-d94e4cdaa57e", "email": "testirtaza1", "groups": [], "permission": "none", "preferences": {} } }
and,
acl.getCurrentPermissions
method returns those things which belongs to the current loggedIn user?to call
acl.getCurrentPermissions
method we have signin by the user credentials(username,password/token){ "id": -9007199254740711, "jsonrpc": "2.0", "result": { "58fdee6c-ed56-8a83-31d5-505748165658": { "view": 1, "operate": 1, "administrate": 1 }, "89fd8cc9-6fa1-a7cb-a492-19eefd689631": { "view": 1, "operate": 1, "administrate": 1 } } }
means I have to create the user first then store these credentials at my space so that I can call
acl.getCurrentPermissions
method and get his VM's and then list those vm's to my portal and allow him to manage their vms from my custom built portal? Is my thinking is correct? -
-
Hi @irtaza9
FYI, for about 2 years, VMs expose acreation
field:"creation": { "date": string, "template": string, "user": string },
With this you can filter VMs by
creation.user
to list only VMs created by a user.
/rest/v0/vms?filter=creation:user:<user-id>
-
you saved my life bro, thank you so much. I got the right way.
-
Is your issue solved @irtaza9 ?
-
@MathieuRA endpoint is not returning vms created by user but that user have vms and it's shown in XO when login by testirtaza1 user.
-
@irtaza9 you need to use the user-id, not the username
-
user-id
bg: when you call
session.signIn
you get the user-id and that id is used to fetch user specific vms.{ "id": -9007199254740991, "jsonrpc": "2.0", "result": { "id": "f2858952-b02a-403a-98ca-d94e4cdaa57e", "email": "testirtaza1", "groups": [], "permission": "none", "preferences": {} } }
@olivierlambert yes, issue is resolved. Thanks to @MathieuRA and @Danp
-
O olivierlambert marked this topic as a question
-
O olivierlambert has marked this topic as solved