ostk.core.filesystem.PermissionSet

class PermissionSet(
self: ostk.core.filesystem.PermissionSet,
can_read: bool,
can_write: bool,
can_execute: bool,
)

Bases: pybind11_object

Construct a PermissionSet with specific read, write, and execute permissions.

Parameters:
  • can_read (bool) -- Whether read permission is granted.

  • can_write (bool) -- Whether write permission is granted.

  • can_execute (bool) -- Whether execute permission is granted.

Example

>>> perm = PermissionSet(True, False, True)  # read and execute only
>>> perm.can_read()  # True
>>> perm.can_write()  # False

Methods

can_execute

Check if execute permission is granted.

can_read

Check if read permission is granted.

can_write

Check if write permission is granted.

is_all

Check if all permissions are granted.

is_none

Check if no permissions are granted.

none

Create a PermissionSet with no permissions.

r

Create a PermissionSet with read permission only.

rw

Create a PermissionSet with read and write permissions.

rwx

Create a PermissionSet with all permissions (read, write, execute).

rx

Create a PermissionSet with read and execute permissions.

w

Create a PermissionSet with write permission only.

x

Create a PermissionSet with execute permission only.

__add__(
self: ostk.core.filesystem.PermissionSet,
arg0: ostk.core.filesystem.PermissionSet,
) ostk.core.filesystem.PermissionSet

Combine two PermissionSets (union of permissions).

can_execute(self: ostk.core.filesystem.PermissionSet) bool

Check if execute permission is granted.

Returns:

True if execute permission is granted.

Return type:

bool

Example

>>> perm = PermissionSet.x()
>>> perm.can_execute()  # True
can_read(self: ostk.core.filesystem.PermissionSet) bool

Check if read permission is granted.

Returns:

True if read permission is granted.

Return type:

bool

Example

>>> perm = PermissionSet.r()
>>> perm.can_read()  # True
can_write(self: ostk.core.filesystem.PermissionSet) bool

Check if write permission is granted.

Returns:

True if write permission is granted.

Return type:

bool

Example

>>> perm = PermissionSet.w()
>>> perm.can_write()  # True
is_all(self: ostk.core.filesystem.PermissionSet) bool

Check if all permissions are granted.

Returns:

True if all permissions (read, write, execute) are granted.

Return type:

bool

Example

>>> perm = PermissionSet.rwx()
>>> perm.is_all()  # True
is_none(self: ostk.core.filesystem.PermissionSet) bool

Check if no permissions are granted.

Returns:

True if no permissions (read, write, execute) are granted.

Return type:

bool

Example

>>> perm = PermissionSet.none()
>>> perm.is_none()  # True
static none() ostk.core.filesystem.PermissionSet

Create a PermissionSet with no permissions.

Returns:

A permission set with no permissions granted.

Return type:

PermissionSet

Example

>>> perm = PermissionSet.none()
>>> perm.is_none()  # True
static r() ostk.core.filesystem.PermissionSet

Create a PermissionSet with read permission only.

Returns:

A permission set with read permission.

Return type:

PermissionSet

Example

>>> perm = PermissionSet.r()
>>> perm.can_read()  # True
>>> perm.can_write()  # False
static rw() ostk.core.filesystem.PermissionSet

Create a PermissionSet with read and write permissions.

Returns:

A permission set with read and write permissions.

Return type:

PermissionSet

Example

>>> perm = PermissionSet.rw()
>>> perm.can_read()  # True
>>> perm.can_write()  # True
>>> perm.can_execute()  # False
static rwx() ostk.core.filesystem.PermissionSet

Create a PermissionSet with all permissions (read, write, execute).

Returns:

A permission set with all permissions.

Return type:

PermissionSet

Example

>>> perm = PermissionSet.rwx()
>>> perm.is_all()  # True
static rx() ostk.core.filesystem.PermissionSet

Create a PermissionSet with read and execute permissions.

Returns:

A permission set with read and execute permissions.

Return type:

PermissionSet

Example

>>> perm = PermissionSet.rx()
>>> perm.can_read()  # True
>>> perm.can_execute()  # True
>>> perm.can_write()  # False
static w() ostk.core.filesystem.PermissionSet

Create a PermissionSet with write permission only.

Returns:

A permission set with write permission.

Return type:

PermissionSet

Example

>>> perm = PermissionSet.w()
>>> perm.can_write()  # True
static x() ostk.core.filesystem.PermissionSet

Create a PermissionSet with execute permission only.

Returns:

A permission set with execute permission.

Return type:

PermissionSet

Example

>>> perm = PermissionSet.x()
>>> perm.can_execute()  # True