Question

Setting security via REST API (v3).

  • 15 February 2018
  • 2 replies
  • 1 view

Badge

Hi,

we use role-based security, and I need to set permissions on various categories and resources for the role.

For some categories/resources, I want to give a role only a subset of permissions.

If I try to set a specific permission on a resource, say category=SharedResources, resource=FME_SHAREDRESOURCE_DATA, permission=SHAREDRESOURCE_READ,

to a role 'DUMMY' that I have previously created, I get an error saying there is no such role in the resource.

If instead I assign a role to the resource, the resource gets all permissions immediately.

If I do not want this role to be able to delete, I must now remove this permission.

Is there a more direct way to achieve what I want?

Thanks,

Michael Neidhardt


2 replies

Badge

Hi @mineisdfe,

There is no one REST API call to assign a role to a resource and configure the permission. The best way to do that is assigning the role and using PUT REST API call to set required permission(s). PUT call will replace existing permissions with defined permission(s). So you can avoid removing unnecessary permissions one by one.

1. POST /security/categories/< category >/resources/< resource >/roles

2. PUT /security/categories/< category >/resources/< resource >/roles/< role >

Hope this helps.

Badge

Hi @mineisdfe,

There is no one REST API call to assign a role to a resource and configure the permission. The best way to do that is assigning the role and using PUT REST API call to set required permission(s). PUT call will replace existing permissions with defined permission(s). So you can avoid removing unnecessary permissions one by one.

1. POST /security/categories/< category >/resources/< resource >/roles

2. PUT /security/categories/< category >/resources/< resource >/roles/< role >

Hope this helps.

Hi and thanks for your reply,

 

I am not asking for a method that assigns a role and configures all permissions.

 

I am asking if there is a method that assigns a role to a resource, without also giving the role all permissions simultaneously.

 

But I suspect it's not possible with the current API.

 

 

Reply