ostk.core.filesystem.PermissionSet¶
- class PermissionSet(
- self: ostk.core.filesystem.PermissionSet,
- can_read: bool,
- can_write: bool,
- can_execute: bool,
- can_read: bool,
Bases:
pybind11_object
Construct a PermissionSet with specific read, write, and execute permissions.
- Parameters:
Example
>>> perm = PermissionSet(True, False, True) # read and execute only >>> perm.can_read() # True >>> perm.can_write() # False
Methods
Check if execute permission is granted.
Check if read permission is granted.
Check if write permission is granted.
Check if all permissions are granted.
Check if no permissions are granted.
Create a PermissionSet with no permissions.
Create a PermissionSet with read permission only.
Create a PermissionSet with read and write permissions.
Create a PermissionSet with all permissions (read, write, execute).
Create a PermissionSet with read and execute permissions.
Create a PermissionSet with write permission only.
Create a PermissionSet with execute permission only.
- __add__( ) 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:
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:
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:
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:
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:
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:
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:
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:
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:
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:
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:
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:
Example
>>> perm = PermissionSet.x() >>> perm.can_execute() # True