Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions common/apps/organization_role/constants.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
from django.db import models


class OrganizationRoleType(models.TextChoices):
OWNER_ROLE = "Owner"
ADMIN_ROLE = "Admin"
EDITOR_ROLE = "Editor"
VIEWER_ROLE = "Viewer"


class OrganizationPermission(models.TextChoices):
# Organization
UPDATE_ORGANIZATION = "UPDATE_ORGANIZATION"
DELETE_ORGANIZATION = "DELETE_ORGANIZATION"

# Organization Role
READ_ORGANIZATION_ROLE = "READ_ORGANIZATION_ROLE"
CREATE_ORGANIZATION_ROLE = "CREATE_ORGANIZATION_ROLE"
UPDATE_ORGANIZATION_ROLE = "UPDATE_ORGANIZATION_ROLE"
DELETE_ORGANIZATION_ROLE = "DELETE_ORGANIZATION_ROLE"

# Organization Member
READ_ORGANIZATION_MEMBER = "READ_ORGANIZATION_MEMBER"
INVITE_ORGANIZATION_MEMBER = "INVITE_ORGANIZATION_MEMBER"
UPDATE_ORGANIZATION_MEMBER_ROLE = "UPDATE_ORGANIZATION_MEMBER_ROLE"
REMOVE_ORGANIZATION_MEMBER = "REMOVE_ORGANIZATION_MEMBER"

# Organization Device
READ_ORGANIZATION_DEVICE = "READ_ORGANIZATION_DEVICE"
CREATE_ORGANIZATION_DEVICE = "CREATE_ORGANIZATION_DEVICE"
UPDATE_ORGANIZATION_DEVICE = "UPDATE_ORGANIZATION_DEVICE"
DELETE_ORGANIZATION_DEVICE = "DELETE_ORGANIZATION_DEVICE"
11 changes: 1 addition & 10 deletions common/apps/refresh_tokens/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,16 +92,7 @@ def validate(self, attrs):
if refresh_token_obj.family.status != RefreshTokenFamilyStatus.Active:
raise TokenError(_("Refresh token is inactive"))

if "access_token_handler" in self.context:
params = {
"access_token": refresh.access_token,
"user_id": refresh.payload["user_id"],
**self.context["access_token_handler_params"],
}
access = self.context["access_token_handler"](**params)
data = {"access": str(access)}
else:
data = {"access": str(refresh.access_token)}
data = {"access": str(refresh.access_token)}

refresh.set_jti()
refresh.set_exp()
Expand Down
6 changes: 6 additions & 0 deletions common/apps/space_role/constants.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
from django.db import models


class SpaceRoleType(models.TextChoices):
ADMIN_ROLE = "Admin"
EDITOR_ROLE = "Editor"
VIEWER_ROLE = "Viewer"


class SpacePermission(models.TextChoices):
# Space
UPDATE_SPACE = "UPDATE_SPACE"
Expand Down