updateRole #
Updates a security role definition.
Note: partial updates are not supported for roles, this API route will replace the entire role content with the provided one.
Future<KuzzleRole> updateRole(String id, Map<String, dynamic> controllers,
{bool waitForRefresh, bool force})
Property | Type | Description |
---|---|---|
id | String | Role identifier |
body | Map<String, dynamic> | Role definition content |
waitForRefresh | bool ( null ) | If set to true , Kuzzle will not respond until the updated role is indexed |
force | bool ( null ) | If set to true , updates the role even if it gives access to non-existent plugins API routes |
body #
Property | Type | Description |
---|---|---|
controllers | Map<String, dynamic>t | Role definition |
Return #
A Role
object representing the updated role.
Usage #
final result = await kuzzle.security.updateRole('read-only', {
'controllers': {
'auth': {
'actions': {
'getCurrentUser': true,
'getMyCredentials': true,
'getMyRights': true,
'logout': true
}
},
'collection': {
'actions': {
'getMapping': true,
'list': true
}
},
'document': {
'actions': {
'count': true,
'get': true,
'mGet': true,
'scroll': true,
'search': true
}
},
'index': {
'actions': {
'list': true
}
}
}
});
/*
Role {
_id: 'read-only',
controllers:
{ auth: { actions: [Object] },
collection: { actions: [Object] },
document: { actions: [Object] },
index: { actions: [Object] } } }
*/
Edit this page on Github(opens new window)