permissionsToActions method

  1. @override
List<Action> permissionsToActions(
  1. List<KeyValueStorePermission> permissions
)
override

Convert a list of permissions to gRPC actions.

Implementation

@override
List<$p.Action> permissionsToActions(
    List<KeyValueStorePermission> permissions) {
  List<$p.Action> actions = permissions.fold(
      [],
      (actions, permission) => switch (permission) {
            KeyValueStorePermission.get => [
                ...actions,
                $p.Action.KeyValueStoreRead
              ],
            KeyValueStorePermission.set => [
                ...actions,
                $p.Action.KeyValueStoreWrite
              ],
            KeyValueStorePermission.delete => [
                ...actions,
                $p.Action.KeyValueStoreDelete
              ]
          });

  return actions;
}