App Permissions

class mastf.core.files.apl.PermissionDefItem(identifier: str, package: str | None = None, label: str | None = None, description: str | None = None, protectionLevel: ~typing.List[str] = <factory>)[source]

Represents a permission definition item.

Parameters:
  • identifier – Identifier of the permission.

  • package – Package associated with the permission (optional).

  • label – Label of the permission (optional).

  • description – Description of the permission (optional).

  • protectionLevel – List of protection levels for the permission (default: empty list).

class mastf.core.files.apl.GroupDefItem(identifier: str, package: str | None = None, label: str | None = None, description: str | None = None, permissions: ~typing.List[~mastf.core.files.apl.PermissionDefItem] = <factory>)[source]

Represents a group definition item.

Parameters:
  • identifier – Identifier of the group.

  • package – Package associated with the group (optional).

  • label – Label of the group (optional).

  • description – Description of the group (optional).

  • permissions – List of permissions in the group (default: empty list).

class mastf.core.files.apl.AppPermissionList(groups: ~typing.List[~mastf.core.files.apl.GroupDefItem] = <factory>, permissions: ~typing.List[~mastf.core.files.apl.PermissionDefItem] = <factory>)[source]

Represents a list of app permissions.

Parameters:
  • groups – List of group definitions (default: empty list).

  • permissions – List of ungrouped permissions (default: empty list).

Example Usage

from mastf.core.files import apl
with open("permissions.apl", "r") as fp:
    x = apl.parse(fp)

x.groups # list of GroupDefItem
x.permissions # ungrouped permission definitons
mastf.core.files.apl.parse(text: str | bytes | IOBase = None) AppPermissionList[source]

Parse app permission data from text or a file-like object.

Parameters:

text – Input text or file-like object containing the permission data.

Returns:

AppPermissionList object representing the parsed data.

Raises:
  • TypeError – If the input text is None.

  • TypeError – If an invalid source type is provided.

mastf.core.files.apl.load(fp: IOBase) AppPermissionList[source]

Load app permission data from a file-like object.

Parameters:

fp – File-like object containing the permission data.

Returns:

AppPermissionList object representing the loaded data.