openslides_backend/permissions/permission_helper.py
def has_organization_management_level(
    datastore: DatastoreService,
    user_id: int,
    expected_level: OrganizationManagementLevel,
) -> bool:
    """Checks wether a user has the minimum necessary OrganizationManagementLevel"""
    if user_id > 0:
        user = datastore.get(
            FullQualifiedId(Collection("user"), user_id),
            ["organization_management_level"],
        )
        return expected_level <= OrganizationManagementLevel(
            user.get("organization_management_level")
        )
    return False
Checks wether a user has the minimum necessary OrganizationManagementLevel
Checks wether a user has the minimum necessary OrganizationManagementLevel
Checks wether a user has the minimum necessary OrganizationManagementLevel
def has_organization_management_level(
    datastore: DatastoreService,
    user_id: int,
    expected_level: OrganizationManagementLevel,
) -> bool:
    if user_id > 0:
        user = datastore.get(
            FullQualifiedId(Collection("user"), user_id),
            ["organization_management_level"],
        )
        return expected_level <= OrganizationManagementLevel(
            user.get("organization_management_level")
        )
    return False
def has_organization_management_level ( datastore : DatastoreService , user_id : int , expected_level : OrganizationManagementLevel , ) -> bool : if user_id > 0 : user = datastore . get ( FullQualifiedId ( Collection ( "user" ) , user_id ) , [ "organization_management_level" ] , ) return expected_level <= OrganizationManagementLevel ( user . get ( "organization_management_level" ) ) return False
Checks wether a user has the minimum necessary OrganizationManagementLevel
Checks wether a user has the minimum necessary OrganizationManagementLevel
"""Checks wether a user has the minimum necessary OrganizationManagementLevel"""
datastore
DatastoreService
user_id
int
expected_level
OrganizationManagementLevel