Role
- class AzuracastPy.models.administration.Role(id: int, name: str, permissions: Dict[Any, Any], links: Links, is_super_admin: bool, _admin)
Represents a radio’s roles.
- __init__(id: int, name: str, permissions: Dict[Any, Any], links: Links, is_super_admin: bool, _admin)
Initializes a
Roleobject.Note
This class should not be initialized directly. Instead, obtain an instance via:
create(),__call__()orroles().
- delete()
Deletes the role from the radio.
Sets all attributes of the current
Roleobject toNone.Usage:
role.delete()
- edit(name: str | None = None, global_permissions: List[GlobalPermissions] | None = None, station_permissions: Dict[str, List[StationPermissions]] | None = None)
Edits the role’s properties.
Updates all edited attributes of the current
Roleobject.- Parameters:
name – (Optional) The new name of the role. Default:
Noneglobal_permissions –
(Optional) The new global permissions of the role. Default:
None.Warning
This will overwrite the role’s existing global permissions. Use the
add_global()andremove_global()methods to interact with the role’s existing global permissions.station_permissions – (Optional) The structure representing the new station permissions of the role. Generate this using the
generate_station_permissions()function. Default:None.
Usage:
from AzuracastPy.enums import GlobalPermissions role.edit( name="New name", global_permissions=[ GlobalPermissions.ADMINISTER_BACKUPS, GlobalPermissions.VIEW_ADMINISTRATION ] )
- permission
An instance of
PermissionsHelper.Provides the interface for working with this role’s permissions.
For example, to add one or more global permissions to this role:
from AzuracastPy.enums import GlobalPermissions admin.permission.add_global(GlobalPermissions.ADMINISTER_ALL) admin.permission.add_global( GlobalPermissions.ADMINISTER_ALL, GlobalPermissions.ADMINISTER_BACKUPS )
To remove one or more global permissions from this role:
from AzuracastPy.enums import GlobalPermissions admin.permission.remove_global(GlobalPermissions.ADMINISTER_ALL) admin.permission.remove_global( GlobalPermissions.ADMINISTER_ALL, GlobalPermissions.ADMINISTER_BACKUPS )