readPermission function

Future<Map> readPermission({
  1. required String fileName,
  2. required bool isFile,
  3. bool isFileUrl = false,
  4. bool isExternalRes = false,
})

Read permission given for the fileName from the associated ACL file.

Parameters:

  • fileName - is the name of the file reading permission from.

  • isFile - flag describing whether fileName is a file or not.

  • isFileUrl - boolean describing whether fileName is the url of the resource. Default: false.

  • isExternalRes - flag describing whether fileName is an external resource shared with the user. If it is set to true, the fileName should be the full URL of the file. Default: false.

Implementation

Future<Map<dynamic, dynamic>> readPermission({
  required String fileName,
  required bool isFile,
  bool isFileUrl = false,
  bool isExternalRes = false,
}) async {
  final resourceUrl = await filenameToResourceUrl(
    fileName: fileName,
    isFile: isFile,
    isExternalRes: isExternalRes,
    isFileUrl: isFileUrl,
  );

  // Read ACL file content
  final Map<dynamic, dynamic> aclContentMap = await readAcl(
    resourceUrl,
    isFile,
  );

  // Extract permission details to a map
  final Map<dynamic, dynamic> permMap = extractAclPerm(aclContentMap);

  return permMap;
}