diff --git a/apps/tickets/handlers/apply_application.py b/apps/tickets/handlers/apply_application.py index 15c76c7e5..5b7712553 100644 --- a/apps/tickets/handlers/apply_application.py +++ b/apps/tickets/handlers/apply_application.py @@ -16,16 +16,18 @@ class Handler(BaseHandler): # permission def _create_application_permission(self): - with tmp_to_root_org(): + org_id = self.ticket.org_id + with tmp_to_org(org_id): application_permission = ApplicationPermission.objects.filter(id=self.ticket.id).first() if application_permission: return application_permission + apply_applications = self.ticket.apply_applications.all() + apply_system_users = self.ticket.apply_system_users.all() + apply_permission_name = self.ticket.apply_permission_name apply_category = self.ticket.apply_category apply_type = self.ticket.apply_type - apply_applications = self.ticket.apply_applications.all() - apply_system_users = self.ticket.apply_system_users.all() apply_date_start = self.ticket.apply_date_start apply_date_expired = self.ticket.apply_date_expired permission_created_by = '{}:{}'.format( diff --git a/apps/tickets/handlers/apply_asset.py b/apps/tickets/handlers/apply_asset.py index 136347782..e9d29697d 100644 --- a/apps/tickets/handlers/apply_asset.py +++ b/apps/tickets/handlers/apply_asset.py @@ -16,15 +16,17 @@ class Handler(BaseHandler): # permission def _create_asset_permission(self): - with tmp_to_root_org(): + org_id = self.ticket.org_id + with tmp_to_org(org_id): asset_permission = AssetPermission.objects.filter(id=self.ticket.id).first() if asset_permission: return asset_permission + apply_nodes = self.ticket.apply_nodes.all() + apply_assets = self.ticket.apply_assets.all() + apply_system_users = self.ticket.apply_system_users.all() + apply_permission_name = self.ticket.apply_permission_name - apply_nodes = self.ticket.apply_nodes.all() - apply_assets = self.ticket.apply_assets.all() - apply_system_users = self.ticket.apply_system_users.all() apply_actions = self.ticket.apply_actions apply_date_start = self.ticket.apply_date_start apply_date_expired = self.ticket.apply_date_expired