readPermission function
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 whetherfileNameis a file or not. -
isFileUrl- boolean describing whetherfileNameis the url of the resource. Default: false. -
isExternalRes- flag describing whetherfileNameis an external resource shared with the user. If it is set to true, thefileNameshould 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;
}