feat(access): Enable Objects from global organization to be viewable by user with the permission
ref: #448 #459
This commit is contained in:
@ -361,9 +361,19 @@ class OrganizationMixin:
|
||||
|
||||
return has_permission
|
||||
|
||||
from settings.models.app_settings import AppSettings
|
||||
|
||||
|
||||
app_settings = AppSettings.objects.get(
|
||||
owner_organization = None
|
||||
)
|
||||
|
||||
for team in self.get_user_teams( user = self.request.user ):
|
||||
|
||||
if team.organization.id == int(organization):
|
||||
if(
|
||||
team.organization.id == int(organization)
|
||||
or getattr(app_settings.global_organization, 'id', 0) == int(organization)
|
||||
):
|
||||
|
||||
for permission in team.permissions.all():
|
||||
|
||||
|
@ -276,6 +276,11 @@ class OrganizationPermissionMixin(
|
||||
|
||||
object_organization: int = getattr(view.get_obj_organization( obj = obj ), 'id', None)
|
||||
|
||||
from settings.models.app_settings import AppSettings
|
||||
|
||||
app_settings = AppSettings.objects.get(
|
||||
owner_organization = None
|
||||
)
|
||||
|
||||
if object_organization:
|
||||
|
||||
@ -283,6 +288,7 @@ class OrganizationPermissionMixin(
|
||||
object_organization
|
||||
in view.get_permission_organizations( view.get_permission_required() )
|
||||
or request.user.is_superuser
|
||||
or getattr(app_settings.global_organization, 'id', 0) == int(object_organization)
|
||||
):
|
||||
|
||||
return True
|
||||
|
Reference in New Issue
Block a user