2016-02-11 22:58:32 +01:00
|
|
|
from ..utils.access_permissions import BaseAccessPermissions
|
2018-11-04 14:02:30 +01:00
|
|
|
from ..utils.auth import GROUP_ADMIN_PK, async_in_some_groups
|
2016-02-11 22:58:32 +01:00
|
|
|
|
2016-02-11 11:29:19 +01:00
|
|
|
|
2016-02-11 22:58:32 +01:00
|
|
|
class ProjectorAccessPermissions(BaseAccessPermissions):
|
|
|
|
"""
|
|
|
|
Access permissions container for Projector and ProjectorViewSet.
|
|
|
|
"""
|
2018-11-01 17:30:18 +01:00
|
|
|
base_permission = 'core.can_see_projector'
|
2016-02-11 22:58:32 +01:00
|
|
|
|
|
|
|
|
|
|
|
class TagAccessPermissions(BaseAccessPermissions):
|
|
|
|
"""
|
|
|
|
Access permissions container for Tag and TagViewSet.
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
|
|
class ChatMessageAccessPermissions(BaseAccessPermissions):
|
|
|
|
"""
|
|
|
|
Access permissions container for ChatMessage and ChatMessageViewSet.
|
|
|
|
"""
|
2018-11-01 17:30:18 +01:00
|
|
|
base_permission = 'core.can_use_chat'
|
2016-02-11 22:58:32 +01:00
|
|
|
|
|
|
|
|
2016-10-21 11:05:24 +02:00
|
|
|
class ProjectorMessageAccessPermissions(BaseAccessPermissions):
|
|
|
|
"""
|
|
|
|
Access permissions for ProjectorMessage.
|
|
|
|
"""
|
2018-11-01 17:30:18 +01:00
|
|
|
base_permission = 'core.can_see_projector'
|
2016-10-21 11:05:24 +02:00
|
|
|
|
|
|
|
|
|
|
|
class CountdownAccessPermissions(BaseAccessPermissions):
|
|
|
|
"""
|
|
|
|
Access permissions for Countdown.
|
|
|
|
"""
|
2018-11-01 17:30:18 +01:00
|
|
|
base_permission = 'core.can_see_projector'
|
2016-10-21 11:05:24 +02:00
|
|
|
|
|
|
|
|
2016-02-11 22:58:32 +01:00
|
|
|
class ConfigAccessPermissions(BaseAccessPermissions):
|
|
|
|
"""
|
|
|
|
Access permissions container for the config (ConfigStore and
|
|
|
|
ConfigViewSet).
|
|
|
|
"""
|
|
|
|
|
2018-11-04 14:02:30 +01:00
|
|
|
|
|
|
|
class HistoryAccessPermissions(BaseAccessPermissions):
|
|
|
|
"""
|
|
|
|
Access permissions container for the Histroy.
|
|
|
|
"""
|
|
|
|
|
|
|
|
async def async_check_permissions(self, user_id: int) -> bool:
|
|
|
|
"""
|
|
|
|
Returns True if the user is in admin group and has read access to
|
|
|
|
model instances.
|
|
|
|
"""
|
|
|
|
return await async_in_some_groups(user_id, [GROUP_ADMIN_PK])
|