grant method
- Set<
String> authKeys, { - int? ttl,
- Set<
String> ? channels, - Set<
String> ? channelGroups, - Set<
String> ? uuids, - bool? write,
- bool? read,
- bool? manage,
- bool? delete,
- bool? get,
- bool? update,
- bool? join,
- Keyset? keyset,
- String? using,
inherited
Use this method to modify permissions for provided authKeys
.
ttl
signifies how long those permissions will be in place.channels
are set of channels for which grant permissions will be applied.channelGroups
are set of channel groups for which grant persmissions will be applied.uuids
are set of target user ids for which grant permissions will be applied.write
is for write permission : true for allowing write operation, false to restrictread
is for read permission : true for allowing read operation, false to restrictmanage
is for manage permission : true for allowing manage operation, false to restrictdelete
is for delete permission : true for allowing delete operation, false to restrictget
is for get permission: true for allowing get operations, false to restrictupdate
is for update permission: true for allowing update opertaions, false to restrictjoin
for join permission: true for allowing join operations, false to restrict
** Permissions can not be modified for channels/channel groups AND UUID(s) (user(s)) in a single method call
Implementation
Future<PamGrantResult> grant(Set<String> authKeys,
{int? ttl,
Set<String>? channels,
Set<String>? channelGroups,
Set<String>? uuids,
bool? write,
bool? read,
bool? manage,
bool? delete,
bool? get,
bool? update,
bool? join,
Keyset? keyset,
String? using}) async {
keyset ??= keysets[using];
Ensure(keyset.secretKey).isNotNull('secretKey');
if ((uuids != null && uuids.isNotEmpty) &&
((channels != null && channels.isNotEmpty) ||
(channelGroups != null && channelGroups.isNotEmpty))) {
Ensure.fail('not-together', 'channles/channelGroups', ['uuids']);
}
var params = PamGrantParams(keyset, authKeys,
ttl: ttl,
channels: channels,
channelGroups: channelGroups,
uuids: uuids,
write: write,
read: read,
manage: manage,
delete: delete,
get: get,
update: update,
join: join);
var result = await defaultFlow<PamGrantParams, PamGrantResult>(
keyset: keyset,
core: this,
params: params,
serialize: (object, [_]) => PamGrantResult.fromJson(object));
if (result.warning) {
_logger.warning(result.message);
}
return result;
}