From d8bb481523c4ed473bd7b668a4f246b55a16b37f Mon Sep 17 00:00:00 2001 From: Benoit Alessandroni <benoit@startinblox.com> Date: Thu, 14 Dec 2023 14:06:21 +0100 Subject: [PATCH 1/4] fix: disable permissions before migration --- djangoldp_tzcld/models.py | 282 +++++++++++++++++++------------------- 1 file changed, 141 insertions(+), 141 deletions(-) diff --git a/djangoldp_tzcld/models.py b/djangoldp_tzcld/models.py index 2dab2e3..49abbec 100644 --- a/djangoldp_tzcld/models.py +++ b/djangoldp_tzcld/models.py @@ -8,7 +8,7 @@ from django.utils.translation import gettext_lazy as _ from djangoldp.models import Model from djangoldp_conversation.models import Conversation, Message from djangoldp_community.models import Community, CommunityMember -from djangoldp_tzcld.permissions import TzcldCommunityProfilePermissions +# from djangoldp_tzcld.permissions import TzcldCommunityProfilePermissions ############################# # Extend user model @@ -27,10 +27,10 @@ class TzcldTerritoryCirconscription(Model): class Meta(Model.Meta): verbose_name = _('TZCLD Circonscription') verbose_name_plural = _("TZCLD Options Circonscriptions") - anonymous_perms = [] - authenticated_perms = ['view'] - owner_perms = ['inherit', 'add', 'change', 'delete'] - superuser_perms = ['inherit', 'change', 'delete'] + # anonymous_perms = [] + # authenticated_perms = ['view'] + # owner_perms = ['inherit', 'add', 'change', 'delete'] + # superuser_perms = ['inherit', 'change', 'delete'] container_path = "tzcld-circonscriptions/" serializer_fields = ['@id', 'name', 'order'] ordering = ['order'] @@ -50,10 +50,10 @@ class TzcldTerritoryDepartment(Model): class Meta(Model.Meta): verbose_name = _('TZCLD Department') verbose_name_plural = _("TZCLD Options Departments") - anonymous_perms = [] - authenticated_perms = ['view'] - owner_perms = ['inherit', 'add', 'change', 'delete'] - superuser_perms = ['inherit', 'change', 'delete'] + # anonymous_perms = [] + # authenticated_perms = ['view'] + # owner_perms = ['inherit', 'add', 'change', 'delete'] + # superuser_perms = ['inherit', 'change', 'delete'] container_path = "tzcld-departments/" serializer_fields = ['@id', 'name', 'job_department'] ordering = ['name'] @@ -73,10 +73,10 @@ class TzcldTerritoryRegion(Model): class Meta(Model.Meta): verbose_name = _('TZCLD Région') verbose_name_plural = _("TZCLD Régions") - anonymous_perms = [] - authenticated_perms = ['view'] - owner_perms = ['inherit', 'add', 'change', 'delete'] - superuser_perms = ['inherit', 'change', 'delete'] + # anonymous_perms = [] + # authenticated_perms = ['view'] + # owner_perms = ['inherit', 'add', 'change', 'delete'] + # superuser_perms = ['inherit', 'change', 'delete'] container_path = "tzcld-regions/" serializer_fields = ['@id', 'name', 'referents'] ordering = ['name'] @@ -95,10 +95,10 @@ class TzcldProfilesMembership(Model): class Meta(Model.Meta): verbose_name = _('TZCLD Membership type') verbose_name_plural = _("TZCLD Options Membership types") - anonymous_perms = [] - authenticated_perms = ['view', 'add'] - owner_perms = ['inherit', 'change', 'delete'] - superuser_perms = ['inherit', 'change', 'delete'] + # anonymous_perms = [] + # authenticated_perms = ['view', 'add'] + # owner_perms = ['inherit', 'change', 'delete'] + # superuser_perms = ['inherit', 'change', 'delete'] container_path = "tzcld-profile-membership/" serializer_fields = ['@id', 'name'] nested_fields = [] @@ -128,10 +128,10 @@ class TzcldProfile(Model): class Meta(Model.Meta): verbose_name = _('TZCLD User Profile') verbose_name_plural = _("TZCLD Users Profiles") - anonymous_perms = [] - authenticated_perms = ['view', 'add'] - owner_perms = ['inherit', 'change', 'delete'] - superuser_perms = ['inherit', 'change', 'delete'] + # anonymous_perms = [] + # authenticated_perms = ['view', 'add'] + # owner_perms = ['inherit', 'change', 'delete'] + # superuser_perms = ['inherit', 'change', 'delete'] ordering = ['user'] serializer_fields = ['@id', 'last_contribution_year', 'jobs', 'regions', 'departments', 'is_member', 'is_national_referent'] rdf_type = "tzcld:profile" @@ -166,10 +166,10 @@ class TzcldProfileJob(Model): class Meta(Model.Meta): verbose_name = _('TZCLD User profile job') verbose_name_plural = _("TZCLD Users profiles jobs") - anonymous_perms = [] - authenticated_perms = ['view', 'add'] - owner_perms = ['inherit', 'change', 'delete'] - superuser_perms = ['inherit', 'change', 'delete'] + # anonymous_perms = [] + # authenticated_perms = ['view', 'add'] + # owner_perms = ['inherit', 'change', 'delete'] + # superuser_perms = ['inherit', 'change', 'delete'] container_path = "tzcld-profile-job/" serializer_fields = ['@id', 'position', 'organisation', 'address', 'postal_code', 'city', 'department','profile', 'link','phone' ,'phone_public' ,'mobile_phone' ,'mobile_phone_public' ,'email' ,'email_public' ] nested_fields = [] @@ -256,10 +256,10 @@ class TzcldTerritoriesStepState(Model): class Meta(Model.Meta): verbose_name = _('TZCLD Territory step state') verbose_name_plural = _("TZCLD Options Territories step states") - anonymous_perms = [] - authenticated_perms = ['view'] - owner_perms = ['inherit'] - superuser_perms = ['inherit'] + # anonymous_perms = [] + # authenticated_perms = ['view'] + # owner_perms = ['inherit'] + # superuser_perms = ['inherit'] container_path = "tzcld-territories-step-states/" serializer_fields = ['@id', 'name'] nested_fields = [] @@ -277,10 +277,10 @@ class TzcldTerritoriesKind(Model): class Meta(Model.Meta): verbose_name = _('TZCLD Territory Kind') verbose_name_plural = _("TZCLD Options Territories Kind") - anonymous_perms = [] - authenticated_perms = ['view'] - owner_perms = ['inherit'] - superuser_perms = ['inherit'] + # anonymous_perms = [] + # authenticated_perms = ['view'] + # owner_perms = ['inherit'] + # superuser_perms = ['inherit'] container_path = "tzcld-kinds/" serializer_fields = ['@id', 'name'] nested_fields = [] @@ -298,10 +298,10 @@ class TzcldTerritoriesOriginMobilization(Model): class Meta(Model.Meta): verbose_name = _('TZCLD Origin Mobilization') verbose_name_plural = _("TZCLD Options Origins Mobilization") - anonymous_perms = [] - authenticated_perms = ['view'] - owner_perms = ['inherit'] - superuser_perms = ['inherit'] + # anonymous_perms = [] + # authenticated_perms = ['view'] + # owner_perms = ['inherit'] + # superuser_perms = ['inherit'] container_path = "tzcld-origins-mobilization/" serializer_fields = ['@id', 'name'] nested_fields = [] @@ -320,10 +320,10 @@ class TzcldTerritoriesTrainingCourse(Model): class Meta(Model.Meta): verbose_name = _('TZCLD Training Course') verbose_name_plural = _("TZCLD Options Training Courses") - anonymous_perms = [] - authenticated_perms = ['view'] - owner_perms = ['inherit'] - superuser_perms = ['inherit'] + # anonymous_perms = [] + # authenticated_perms = ['view'] + # owner_perms = ['inherit'] + # superuser_perms = ['inherit'] container_path = "tzcld-training-courses/" serializer_fields = ['@id', 'name'] nested_fields = [] @@ -341,10 +341,10 @@ class TzcldTerritoriesTrainingPromotion(Model): class Meta(Model.Meta): verbose_name = _('TZCLD Training Promotion') verbose_name_plural = _("TZCLD Options Training Promotions") - anonymous_perms = [] - authenticated_perms = ['view'] - owner_perms = ['inherit'] - superuser_perms = ['inherit'] + # anonymous_perms = [] + # authenticated_perms = ['view'] + # owner_perms = ['inherit'] + # superuser_perms = ['inherit'] container_path = "tzcld-training-promotions/" serializer_fields = ['@id', 'name'] nested_fields = [] @@ -363,10 +363,10 @@ class TzcldTerritoriesTeamUserState(Model): class Meta(Model.Meta): verbose_name = _('TZCLD Team User State') verbose_name_plural = _("TZCLD Options Team User States") - anonymous_perms = [] - authenticated_perms = ['view'] - owner_perms = ['inherit'] - superuser_perms = ['inherit'] + # anonymous_perms = [] + # authenticated_perms = ['view'] + # owner_perms = ['inherit'] + # superuser_perms = ['inherit'] ordering = ['order'] container_path = "tzcld-team-user-states/" serializer_fields = ['@id', 'name', 'order'] @@ -394,11 +394,11 @@ class TzcldCommunity(Model): class Meta(Model.Meta): verbose_name = _('TZCLD Territory Profile') verbose_name_plural = _("TZCLD Territories Profiles") - permission_classes = [TzcldCommunityProfilePermissions] - anonymous_perms = [] - authenticated_perms = ['view', 'add'] - owner_perms = ['inherit', 'change', 'delete'] - superuser_perms = ['inherit'] + # permission_classes = [TzcldCommunityProfilePermissions] + # anonymous_perms = [] + # authenticated_perms = ['view', 'add'] + # owner_perms = ['inherit', 'change', 'delete'] + # superuser_perms = ['inherit'] ordering = ['community'] container_path = "tzcld-communities/" serializer_fields = ['@id', 'community', 'kind', 'step_state', 'kind', 'departments', 'regions', 'locations', 'primary_contact', 'membership', 'membership_organisation_name', 'visible'] @@ -428,11 +428,11 @@ class TzcldCommunityIdentity(Model): auto_author = 'author' verbose_name = _('TZCLD Territory Identity') verbose_name_plural = _("TZCLD Territories Identities") - permission_classes = [TzcldCommunityProfilePermissions] - anonymous_perms = [] - authenticated_perms = ['view', 'add'] - owner_perms = ['inherit', 'change', 'delete'] - superuser_perms = ['inherit'] + # permission_classes = [TzcldCommunityProfilePermissions] + # anonymous_perms = [] + # authenticated_perms = ['view', 'add'] + # owner_perms = ['inherit', 'change', 'delete'] + # superuser_perms = ['inherit'] ordering = ['community'] container_path = "tzcld-communities-identity/" serializer_fields = ['@id', 'community', 'emergence_date', 'habilitation_date', 'origin_mobilization', 'application_date', 'signatory_structure', 'birth_date', 'last_contribution_date', 'territories_project_team_memebers', 'territories_trainings', 'conversations', 'tzcld_admins_community_shared_notes', 'tzcld_admins_community_shared_files', 'date', 'author', 'territories_political_landscape_deputies', 'territories_political_landscape_senators'] @@ -461,10 +461,10 @@ class TzcldTerritoryLocation(Model): class Meta(Model.Meta): verbose_name = _('TZCLD Territory location') verbose_name_plural = _("TZCLD Territories locations") - anonymous_perms = [] - authenticated_perms = ['view', 'add'] - owner_perms = ['inherit', 'change', 'delete'] - superuser_perms = ['inherit'] + # anonymous_perms = [] + # authenticated_perms = ['view', 'add'] + # owner_perms = ['inherit', 'change', 'delete'] + # superuser_perms = ['inherit'] container_path = "tzcld-territories-location/" serializer_fields = ['@id', 'name', 'address', 'postal_code', 'city', 'phones', 'emails', 'community'] nested_fields = [] @@ -489,10 +489,10 @@ class TzcldTerritoryProjectTeamMember(Model): class Meta(Model.Meta): verbose_name = _('TZCLD Territory Project Team Member') verbose_name_plural = _("TZCLD Territories Project Team Members") - anonymous_perms = [] - authenticated_perms = ['view', 'add'] - owner_perms = ['inherit', 'change', 'delete'] - superuser_perms = ['inherit'] + # anonymous_perms = [] + # authenticated_perms = ['view', 'add'] + # owner_perms = ['inherit', 'change', 'delete'] + # superuser_perms = ['inherit'] container_path = "tzcld-territories-project-team-memeber/" serializer_fields = ['@id', 'user', 'user_state', 'etp', 'attachment_structure', 'community_identity'] nested_fields = ['community_identity'] @@ -513,10 +513,10 @@ class TzcldTerritoryPoliticalLandscapeDeputy(Model): class Meta(Model.Meta): verbose_name = _('TZCLD Territory Political Landscape Deputy') verbose_name_plural = _("TZCLD Territories Political Landscape Deputies") - anonymous_perms = [] - authenticated_perms = ['view', 'add'] - owner_perms = ['inherit', 'change', 'delete'] - superuser_perms = ['inherit'] + # anonymous_perms = [] + # authenticated_perms = ['view', 'add'] + # owner_perms = ['inherit', 'change', 'delete'] + # superuser_perms = ['inherit'] container_path = "tzcld-territories-political-landscape-deputy/" serializer_fields = ['@id', 'deputy', 'circonscription', 'community_identity'] nested_fields = ['community_identity'] @@ -537,10 +537,10 @@ class TzcldTerritoryPoliticalLandscapeSenator(Model): class Meta(Model.Meta): verbose_name = _('TZCLD Territory Political Landscape Senator') verbose_name_plural = _("TZCLD Territories Political Landscape Senators") - anonymous_perms = [] - authenticated_perms = ['view', 'add'] - owner_perms = ['inherit', 'change', 'delete'] - superuser_perms = ['inherit'] + # anonymous_perms = [] + # authenticated_perms = ['view', 'add'] + # owner_perms = ['inherit', 'change', 'delete'] + # superuser_perms = ['inherit'] container_path = "tzcld-territories-political-landscape-senator/" serializer_fields = ['@id', 'senator', 'circonscription', 'community_identity'] nested_fields = ['community_identity'] @@ -561,10 +561,10 @@ class TzcldTerritoryTraining(Model): class Meta(Model.Meta): verbose_name = _('TZCLD Territory Training') verbose_name_plural = _("TZCLD Territories Trainings") - anonymous_perms = [] - authenticated_perms = ['view', 'add'] - owner_perms = ['inherit', 'change', 'delete'] - superuser_perms = ['inherit'] + # anonymous_perms = [] + # authenticated_perms = ['view', 'add'] + # owner_perms = ['inherit', 'change', 'delete'] + # superuser_perms = ['inherit'] container_path = "tzcld-territories-training/" serializer_fields = ['@id', 'training_course', 'training_promotion', 'training_person', 'community_identity'] nested_fields = ['community_identity'] @@ -584,10 +584,10 @@ class TzcldCommunityDeliberation(Model): class Meta(Model.Meta): verbose_name = _('TZCLD Territory deliberation') verbose_name_plural = _("TZCLD Options Territories deliberations") - anonymous_perms = [] - authenticated_perms = ['view', 'add'] - owner_perms = ['inherit', 'change', 'delete'] - superuser_perms = ['inherit'] + # anonymous_perms = [] + # authenticated_perms = ['view', 'add'] + # owner_perms = ['inherit', 'change', 'delete'] + # superuser_perms = ['inherit'] container_path = "tzcld-communities-deliberations/" serializer_fields = ['@id', 'name'] nested_fields = [] @@ -605,10 +605,10 @@ class TzcldOtherCommunityDeliberation(Model): class Meta(Model.Meta): verbose_name = _('TZCLD Other Territory deliberation') verbose_name_plural = _("TZCLD Options Other Community deliberations") - anonymous_perms = [] - authenticated_perms = ['view', 'add'] - owner_perms = ['inherit', 'change', 'delete'] - superuser_perms = ['inherit'] + # anonymous_perms = [] + # authenticated_perms = ['view', 'add'] + # owner_perms = ['inherit', 'change', 'delete'] + # superuser_perms = ['inherit'] container_path = "tzcld-others-communities-deliberations/" serializer_fields = ['@id', 'name'] nested_fields = [] @@ -627,10 +627,10 @@ class TzcldCouncilDepartmentDeliberation(Model): class Meta(Model.Meta): verbose_name = _('TZCLD Council department deliberation') verbose_name_plural = _("TZCLD Options Council department deliberations") - anonymous_perms = [] - authenticated_perms = ['view', 'add'] - owner_perms = ['inherit', 'change', 'delete'] - superuser_perms = ['inherit'] + # anonymous_perms = [] + # authenticated_perms = ['view', 'add'] + # owner_perms = ['inherit', 'change', 'delete'] + # superuser_perms = ['inherit'] container_path = "tzcld-councils-departments-deliberations/" serializer_fields = ['@id', 'name'] nested_fields = [] @@ -651,10 +651,10 @@ class TzcldCommunityEvaluationPointPart(Model): class Meta(Model.Meta): verbose_name = _('TZCLD Territory Evaluation Point Part') verbose_name_plural = _("TZCLD Territories Evaluation Point Parts") - anonymous_perms = [] - authenticated_perms = ['view', 'add'] - owner_perms = ['inherit', 'change', 'delete'] - superuser_perms = ['inherit'] + # anonymous_perms = [] + # authenticated_perms = ['view', 'add'] + # owner_perms = ['inherit', 'change', 'delete'] + # superuser_perms = ['inherit'] container_path = "tzcld-evaluation-point-parts/" serializer_fields = ['@id', 'name', 'title', 'subtitle', 'order', 'part_points'] ordering = ['order'] @@ -694,10 +694,10 @@ class TzcldCommunityEvaluationPoint(Model): class Meta(Model.Meta): verbose_name = _('TZCLD Territory Evaluation Point') verbose_name_plural = _("TZCLD Territories Evaluation Points") - anonymous_perms = [] - authenticated_perms = ['view', 'add'] - owner_perms = ['inherit', 'change', 'delete'] - superuser_perms = ['inherit'] + # anonymous_perms = [] + # authenticated_perms = ['view', 'add'] + # owner_perms = ['inherit', 'change', 'delete'] + # superuser_perms = ['inherit'] ordering = ['order'] container_path = "tzcld-communities-evaluation-points/" serializer_fields = ['@id', 'name', 'order', 'part', 'points', 'fieldType', 'evaluation_point_answer'] @@ -727,11 +727,11 @@ class TzcldCommunityEvaluationPointAnswer(Model): auto_author = 'author' verbose_name = _('TZCLD Territory Evaluation Point Answer') verbose_name_plural = _("TZCLD Territories Evaluation Point answers") - permission_classes = [TzcldCommunityProfilePermissions] - anonymous_perms = [] - authenticated_perms = ['view', 'add'] - owner_perms = ['inherit', 'change', 'delete'] - superuser_perms = ['inherit'] + # permission_classes = [TzcldCommunityProfilePermissions] + # anonymous_perms = [] + # authenticated_perms = ['view', 'add'] + # owner_perms = ['inherit', 'change', 'delete'] + # superuser_perms = ['inherit'] container_path = "tzcld-communities-evaluation-point-answers/" serializer_fields = ['@id', 'answer', 'answer_community_deliberation', 'answer_other_community_deliberation', 'answer_concil_department_deliberation', 'comment', 'evaluation_point', 'community', 'date', 'author'] rdf_type = "tzcld:communityEvaluationPointAnswer" @@ -759,10 +759,10 @@ class TzcldContactPhone(Model): class Meta(Model.Meta): verbose_name = _('TZCLD Phone') verbose_name_plural = _("TZCLD Phones") - anonymous_perms = [] - authenticated_perms = ['view', 'add'] - owner_perms = ['inherit', 'change', 'delete'] - superuser_perms = ['inherit'] + # anonymous_perms = [] + # authenticated_perms = ['view', 'add'] + # owner_perms = ['inherit', 'change', 'delete'] + # superuser_perms = ['inherit'] container_path = "tzcld-contact-phone/" serializer_fields = ['@id', 'phone', 'phone_type', 'phone_public', 'job', 'location'] nested_fields = [] @@ -784,10 +784,10 @@ class TzcldContactEmail(Model): class Meta(Model.Meta): verbose_name = _('TZCLD Email') verbose_name_plural = _("TZCLD Emails") - anonymous_perms = [] - authenticated_perms = ['view', 'add'] - owner_perms = ['inherit', 'change', 'delete'] - superuser_perms = ['inherit'] + # anonymous_perms = [] + # authenticated_perms = ['view', 'add'] + # owner_perms = ['inherit', 'change', 'delete'] + # superuser_perms = ['inherit'] container_path = "tzcld-contact-email/" serializer_fields = ['@id', 'email', 'email_type', 'email_public', 'job', 'location'] nested_fields = [] @@ -812,10 +812,10 @@ class TzcldTerritoryRequest(Model): auto_author = 'author' verbose_name = _('TZCLD Territory Request') verbose_name_plural = _("TZCLD Territories Requests") - anonymous_perms = [] - authenticated_perms = ['view', 'add'] - owner_perms = ['inherit', 'change', 'delete'] - superuser_perms = ['inherit'] + # anonymous_perms = [] + # authenticated_perms = ['view', 'add'] + # owner_perms = ['inherit', 'change', 'delete'] + # superuser_perms = ['inherit'] container_path = "tzcld-territory-request/" serializer_fields = ['@id', 'user', 'date', 'contactType', 'subject', 'community', 'author'] nested_fields = ['user', 'community'] @@ -843,10 +843,10 @@ class TzcldTerritorySynthesisFollowed(Model): auto_author = 'author' verbose_name = _('TZCLD Territory Synthesis Followed') verbose_name_plural = _("TZCLD Territories Synthesis Followed") - anonymous_perms = [] - authenticated_perms = ['view', 'add'] - owner_perms = ['inherit', 'change', 'delete'] - superuser_perms = ['inherit'] + # anonymous_perms = [] + # authenticated_perms = ['view', 'add'] + # owner_perms = ['inherit', 'change', 'delete'] + # superuser_perms = ['inherit'] container_path = "tzcld-territory-synthesis-followed/" serializer_fields = ['@id', 'context', 'strongPoints', 'questions', 'needs', 'targetdate', 'community', 'tzcld_referents_community_shared_notes', 'date', 'author', 'tzcld_referents_community_shared_files'] nested_fields = ['community'] @@ -867,10 +867,10 @@ class TzcldCommunityFollowedPointPart(Model): class Meta(Model.Meta): verbose_name = _('TZCLD Territory Followed Point Part') verbose_name_plural = _("TZCLD Territories Followed Point Parts") - anonymous_perms = [] - authenticated_perms = ['view', 'add'] - owner_perms = ['inherit', 'change', 'delete'] - superuser_perms = ['inherit'] + # anonymous_perms = [] + # authenticated_perms = ['view', 'add'] + # owner_perms = ['inherit', 'change', 'delete'] + # superuser_perms = ['inherit'] container_path = "tzcld-followed-point-parts/" serializer_fields = ['@id', 'name', 'title', 'order', 'followed_part_points'] ordering = ['order'] @@ -906,10 +906,10 @@ class TzcldCommunityFollowedPoint(Model): class Meta(Model.Meta): verbose_name = _('TZCLD Territory Followed Point') verbose_name_plural = _("TZCLD Territories Followed Points") - anonymous_perms = [] - authenticated_perms = ['view', 'add'] - owner_perms = ['inherit', 'change', 'delete'] - superuser_perms = ['inherit'] + # anonymous_perms = [] + # authenticated_perms = ['view', 'add'] + # owner_perms = ['inherit', 'change', 'delete'] + # superuser_perms = ['inherit'] ordering = ['order'] container_path = "tzcld-communities-followed-points/" serializer_fields = ['@id', 'name', 'order', 'part', 'fieldType', 'helpComment'] @@ -935,11 +935,11 @@ class TzcldCommunityFollowedPointAnswer(Model): auto_author = 'author' verbose_name = _('TZCLD Territory Followed Point Answer') verbose_name_plural = _("TZCLD Territories Followed Point answers") - permission_classes = [TzcldCommunityProfilePermissions] - anonymous_perms = [] - authenticated_perms = ['view', 'add'] - owner_perms = ['inherit', 'change', 'delete'] - superuser_perms = ['inherit'] + # permission_classes = [TzcldCommunityProfilePermissions] + # anonymous_perms = [] + # authenticated_perms = ['view', 'add'] + # owner_perms = ['inherit', 'change', 'delete'] + # superuser_perms = ['inherit'] container_path = "tzcld-communities-followed-point-answers/" serializer_fields = ['@id', 'answer', 'followed_point','community', 'date', 'author'] rdf_type = "tzcld:communityFollowedPointAnswer" @@ -965,10 +965,10 @@ class TzcldTerritorySharedNote(Model): auto_author = 'author' verbose_name = _('TZCLD Territory Shared Note') verbose_name_plural = _("TZCLD Territories Shared Notes") - anonymous_perms = [] - authenticated_perms = ['view', 'add'] - owner_perms = ['inherit', 'change', 'delete'] - superuser_perms = ['inherit'] + # anonymous_perms = [] + # authenticated_perms = ['view', 'add'] + # owner_perms = ['inherit', 'change', 'delete'] + # superuser_perms = ['inherit'] container_path = "tzcld-territory-shared-notes/" serializer_fields = ['@id', 'author', 'longdesc', 'community_admins', 'community_referents', 'conversations', 'date'] nested_fields = ['author', 'community_admins', 'community_referents', 'conversations'] @@ -994,10 +994,10 @@ class TzcldTerritorySharedFile(Model): auto_author = 'author' verbose_name = _('TZCLD Territory Shared File') verbose_name_plural = _("TZCLD Territories Shared Files") - anonymous_perms = [] - authenticated_perms = ['view', 'add'] - owner_perms = ['inherit', 'change', 'delete'] - superuser_perms = ['inherit'] + # anonymous_perms = [] + # authenticated_perms = ['view', 'add'] + # owner_perms = ['inherit', 'change', 'delete'] + # superuser_perms = ['inherit'] container_path = "tzcld-territory-shared-files/" serializer_fields = ['@id', 'author', 'name', 'date', 'document', 'community_admins', 'community_referents'] nested_fields = ['author', 'community_admins', 'community_referents'] -- GitLab From 6504093ce88a572624449d64bd831d90f1457060 Mon Sep 17 00:00:00 2001 From: Benoit Alessandroni <benoit@startinblox.com> Date: Thu, 14 Dec 2023 15:05:43 +0100 Subject: [PATCH 2/4] add: migration --- ...4_alter_tzcldcommunity_options_and_more.py | 320 ++++++++++++++++++ djangoldp_tzcld/permissions.py | 4 +- 2 files changed, 322 insertions(+), 2 deletions(-) create mode 100644 djangoldp_tzcld/migrations/0064_alter_tzcldcommunity_options_and_more.py diff --git a/djangoldp_tzcld/migrations/0064_alter_tzcldcommunity_options_and_more.py b/djangoldp_tzcld/migrations/0064_alter_tzcldcommunity_options_and_more.py new file mode 100644 index 0000000..a46f079 --- /dev/null +++ b/djangoldp_tzcld/migrations/0064_alter_tzcldcommunity_options_and_more.py @@ -0,0 +1,320 @@ +# Generated by Django 4.2.8 on 2023-12-14 13:59 + +from django.db import migrations +import djangoldp.fields + + +class Migration(migrations.Migration): + + dependencies = [ + ('djangoldp_tzcld', '0063_remove_tzcldterritorypoliticallandscapedeputy_circonscriptions_and_more'), + ] + + operations = [ + migrations.AlterModelOptions( + name='tzcldcommunity', + options={'default_permissions': {'control', 'add', 'view', 'change', 'delete'}, 'ordering': ['community'], 'verbose_name': 'TZCLD Territory Profile', 'verbose_name_plural': 'TZCLD Territories Profiles'}, + ), + migrations.AlterModelOptions( + name='tzcldcommunitydeliberation', + options={'default_permissions': {'control', 'add', 'view', 'change', 'delete'}, 'verbose_name': 'TZCLD Territory deliberation', 'verbose_name_plural': 'TZCLD Options Territories deliberations'}, + ), + migrations.AlterModelOptions( + name='tzcldcommunityevaluationpoint', + options={'default_permissions': {'control', 'add', 'view', 'change', 'delete'}, 'ordering': ['order'], 'verbose_name': 'TZCLD Territory Evaluation Point', 'verbose_name_plural': 'TZCLD Territories Evaluation Points'}, + ), + migrations.AlterModelOptions( + name='tzcldcommunityevaluationpointanswer', + options={'default_permissions': {'control', 'add', 'view', 'change', 'delete'}, 'verbose_name': 'TZCLD Territory Evaluation Point Answer', 'verbose_name_plural': 'TZCLD Territories Evaluation Point answers'}, + ), + migrations.AlterModelOptions( + name='tzcldcommunityevaluationpointpart', + options={'default_permissions': {'control', 'add', 'view', 'change', 'delete'}, 'ordering': ['order'], 'verbose_name': 'TZCLD Territory Evaluation Point Part', 'verbose_name_plural': 'TZCLD Territories Evaluation Point Parts'}, + ), + migrations.AlterModelOptions( + name='tzcldcommunityfollowedpoint', + options={'default_permissions': {'control', 'add', 'view', 'change', 'delete'}, 'ordering': ['order'], 'verbose_name': 'TZCLD Territory Followed Point', 'verbose_name_plural': 'TZCLD Territories Followed Points'}, + ), + migrations.AlterModelOptions( + name='tzcldcommunityfollowedpointanswer', + options={'default_permissions': {'control', 'add', 'view', 'change', 'delete'}, 'verbose_name': 'TZCLD Territory Followed Point Answer', 'verbose_name_plural': 'TZCLD Territories Followed Point answers'}, + ), + migrations.AlterModelOptions( + name='tzcldcommunityfollowedpointpart', + options={'default_permissions': {'control', 'add', 'view', 'change', 'delete'}, 'ordering': ['order'], 'verbose_name': 'TZCLD Territory Followed Point Part', 'verbose_name_plural': 'TZCLD Territories Followed Point Parts'}, + ), + migrations.AlterModelOptions( + name='tzcldcommunityidentity', + options={'default_permissions': {'control', 'add', 'view', 'change', 'delete'}, 'ordering': ['community'], 'verbose_name': 'TZCLD Territory Identity', 'verbose_name_plural': 'TZCLD Territories Identities'}, + ), + migrations.AlterModelOptions( + name='tzcldcontactemail', + options={'default_permissions': {'control', 'add', 'view', 'change', 'delete'}, 'verbose_name': 'TZCLD Email', 'verbose_name_plural': 'TZCLD Emails'}, + ), + migrations.AlterModelOptions( + name='tzcldcontactphone', + options={'default_permissions': {'control', 'add', 'view', 'change', 'delete'}, 'verbose_name': 'TZCLD Phone', 'verbose_name_plural': 'TZCLD Phones'}, + ), + migrations.AlterModelOptions( + name='tzcldcouncildepartmentdeliberation', + options={'default_permissions': {'control', 'add', 'view', 'change', 'delete'}, 'verbose_name': 'TZCLD Council department deliberation', 'verbose_name_plural': 'TZCLD Options Council department deliberations'}, + ), + migrations.AlterModelOptions( + name='tzcldothercommunitydeliberation', + options={'default_permissions': {'control', 'add', 'view', 'change', 'delete'}, 'verbose_name': 'TZCLD Other Territory deliberation', 'verbose_name_plural': 'TZCLD Options Other Community deliberations'}, + ), + migrations.AlterModelOptions( + name='tzcldprofile', + options={'default_permissions': {'control', 'add', 'view', 'change', 'delete'}, 'ordering': ['user'], 'verbose_name': 'TZCLD User Profile', 'verbose_name_plural': 'TZCLD Users Profiles'}, + ), + migrations.AlterModelOptions( + name='tzcldprofilejob', + options={'default_permissions': {'control', 'add', 'view', 'change', 'delete'}, 'verbose_name': 'TZCLD User profile job', 'verbose_name_plural': 'TZCLD Users profiles jobs'}, + ), + migrations.AlterModelOptions( + name='tzcldprofilesmembership', + options={'default_permissions': {'control', 'add', 'view', 'change', 'delete'}, 'verbose_name': 'TZCLD Membership type', 'verbose_name_plural': 'TZCLD Options Membership types'}, + ), + migrations.AlterModelOptions( + name='tzcldterritorieskind', + options={'default_permissions': {'control', 'add', 'view', 'change', 'delete'}, 'verbose_name': 'TZCLD Territory Kind', 'verbose_name_plural': 'TZCLD Options Territories Kind'}, + ), + migrations.AlterModelOptions( + name='tzcldterritoriesoriginmobilization', + options={'default_permissions': {'control', 'add', 'view', 'change', 'delete'}, 'verbose_name': 'TZCLD Origin Mobilization', 'verbose_name_plural': 'TZCLD Options Origins Mobilization'}, + ), + migrations.AlterModelOptions( + name='tzcldterritoriesstepstate', + options={'default_permissions': {'control', 'add', 'view', 'change', 'delete'}, 'verbose_name': 'TZCLD Territory step state', 'verbose_name_plural': 'TZCLD Options Territories step states'}, + ), + migrations.AlterModelOptions( + name='tzcldterritoriesteamuserstate', + options={'default_permissions': {'control', 'add', 'view', 'change', 'delete'}, 'ordering': ['order'], 'verbose_name': 'TZCLD Team User State', 'verbose_name_plural': 'TZCLD Options Team User States'}, + ), + migrations.AlterModelOptions( + name='tzcldterritoriestrainingcourse', + options={'default_permissions': {'control', 'add', 'view', 'change', 'delete'}, 'verbose_name': 'TZCLD Training Course', 'verbose_name_plural': 'TZCLD Options Training Courses'}, + ), + migrations.AlterModelOptions( + name='tzcldterritoriestrainingpromotion', + options={'default_permissions': {'control', 'add', 'view', 'change', 'delete'}, 'verbose_name': 'TZCLD Training Promotion', 'verbose_name_plural': 'TZCLD Options Training Promotions'}, + ), + migrations.AlterModelOptions( + name='tzcldterritorycirconscription', + options={'default_permissions': {'control', 'add', 'view', 'change', 'delete'}, 'ordering': ['order'], 'verbose_name': 'TZCLD Circonscription', 'verbose_name_plural': 'TZCLD Options Circonscriptions'}, + ), + migrations.AlterModelOptions( + name='tzcldterritorydepartment', + options={'default_permissions': {'control', 'add', 'view', 'change', 'delete'}, 'ordering': ['name'], 'verbose_name': 'TZCLD Department', 'verbose_name_plural': 'TZCLD Options Departments'}, + ), + migrations.AlterModelOptions( + name='tzcldterritorylocation', + options={'default_permissions': {'control', 'add', 'view', 'change', 'delete'}, 'verbose_name': 'TZCLD Territory location', 'verbose_name_plural': 'TZCLD Territories locations'}, + ), + migrations.AlterModelOptions( + name='tzcldterritorypoliticallandscapedeputy', + options={'default_permissions': {'control', 'add', 'view', 'change', 'delete'}, 'verbose_name': 'TZCLD Territory Political Landscape Deputy', 'verbose_name_plural': 'TZCLD Territories Political Landscape Deputies'}, + ), + migrations.AlterModelOptions( + name='tzcldterritorypoliticallandscapesenator', + options={'default_permissions': {'control', 'add', 'view', 'change', 'delete'}, 'verbose_name': 'TZCLD Territory Political Landscape Senator', 'verbose_name_plural': 'TZCLD Territories Political Landscape Senators'}, + ), + migrations.AlterModelOptions( + name='tzcldterritoryprojectteammember', + options={'default_permissions': {'control', 'add', 'view', 'change', 'delete'}, 'verbose_name': 'TZCLD Territory Project Team Member', 'verbose_name_plural': 'TZCLD Territories Project Team Members'}, + ), + migrations.AlterModelOptions( + name='tzcldterritoryregion', + options={'default_permissions': {'control', 'add', 'view', 'change', 'delete'}, 'ordering': ['name'], 'verbose_name': 'TZCLD Région', 'verbose_name_plural': 'TZCLD Régions'}, + ), + migrations.AlterModelOptions( + name='tzcldterritoryrequest', + options={'default_permissions': {'control', 'add', 'view', 'change', 'delete'}, 'verbose_name': 'TZCLD Territory Request', 'verbose_name_plural': 'TZCLD Territories Requests'}, + ), + migrations.AlterModelOptions( + name='tzcldterritorysharedfile', + options={'default_permissions': {'control', 'add', 'view', 'change', 'delete'}, 'verbose_name': 'TZCLD Territory Shared File', 'verbose_name_plural': 'TZCLD Territories Shared Files'}, + ), + migrations.AlterModelOptions( + name='tzcldterritorysharednote', + options={'default_permissions': {'control', 'add', 'view', 'change', 'delete'}, 'verbose_name': 'TZCLD Territory Shared Note', 'verbose_name_plural': 'TZCLD Territories Shared Notes'}, + ), + migrations.AlterModelOptions( + name='tzcldterritorysynthesisfollowed', + options={'default_permissions': {'control', 'add', 'view', 'change', 'delete'}, 'verbose_name': 'TZCLD Territory Synthesis Followed', 'verbose_name_plural': 'TZCLD Territories Synthesis Followed'}, + ), + migrations.AlterModelOptions( + name='tzcldterritorytraining', + options={'default_permissions': {'control', 'add', 'view', 'change', 'delete'}, 'verbose_name': 'TZCLD Territory Training', 'verbose_name_plural': 'TZCLD Territories Trainings'}, + ), + migrations.AlterField( + model_name='tzcldcommunity', + name='urlid', + field=djangoldp.fields.LDPUrlField(blank=True, db_index=True, null=True, unique=True), + ), + migrations.AlterField( + model_name='tzcldcommunitydeliberation', + name='urlid', + field=djangoldp.fields.LDPUrlField(blank=True, db_index=True, null=True, unique=True), + ), + migrations.AlterField( + model_name='tzcldcommunityevaluationpoint', + name='urlid', + field=djangoldp.fields.LDPUrlField(blank=True, db_index=True, null=True, unique=True), + ), + migrations.AlterField( + model_name='tzcldcommunityevaluationpointanswer', + name='urlid', + field=djangoldp.fields.LDPUrlField(blank=True, db_index=True, null=True, unique=True), + ), + migrations.AlterField( + model_name='tzcldcommunityevaluationpointpart', + name='urlid', + field=djangoldp.fields.LDPUrlField(blank=True, db_index=True, null=True, unique=True), + ), + migrations.AlterField( + model_name='tzcldcommunityfollowedpoint', + name='urlid', + field=djangoldp.fields.LDPUrlField(blank=True, db_index=True, null=True, unique=True), + ), + migrations.AlterField( + model_name='tzcldcommunityfollowedpointanswer', + name='urlid', + field=djangoldp.fields.LDPUrlField(blank=True, db_index=True, null=True, unique=True), + ), + migrations.AlterField( + model_name='tzcldcommunityfollowedpointpart', + name='urlid', + field=djangoldp.fields.LDPUrlField(blank=True, db_index=True, null=True, unique=True), + ), + migrations.AlterField( + model_name='tzcldcommunityidentity', + name='urlid', + field=djangoldp.fields.LDPUrlField(blank=True, db_index=True, null=True, unique=True), + ), + migrations.AlterField( + model_name='tzcldcontactemail', + name='urlid', + field=djangoldp.fields.LDPUrlField(blank=True, db_index=True, null=True, unique=True), + ), + migrations.AlterField( + model_name='tzcldcontactphone', + name='urlid', + field=djangoldp.fields.LDPUrlField(blank=True, db_index=True, null=True, unique=True), + ), + migrations.AlterField( + model_name='tzcldcouncildepartmentdeliberation', + name='urlid', + field=djangoldp.fields.LDPUrlField(blank=True, db_index=True, null=True, unique=True), + ), + migrations.AlterField( + model_name='tzcldothercommunitydeliberation', + name='urlid', + field=djangoldp.fields.LDPUrlField(blank=True, db_index=True, null=True, unique=True), + ), + migrations.AlterField( + model_name='tzcldprofile', + name='urlid', + field=djangoldp.fields.LDPUrlField(blank=True, db_index=True, null=True, unique=True), + ), + migrations.AlterField( + model_name='tzcldprofilejob', + name='urlid', + field=djangoldp.fields.LDPUrlField(blank=True, db_index=True, null=True, unique=True), + ), + migrations.AlterField( + model_name='tzcldprofilesmembership', + name='urlid', + field=djangoldp.fields.LDPUrlField(blank=True, db_index=True, null=True, unique=True), + ), + migrations.AlterField( + model_name='tzcldterritorieskind', + name='urlid', + field=djangoldp.fields.LDPUrlField(blank=True, db_index=True, null=True, unique=True), + ), + migrations.AlterField( + model_name='tzcldterritoriesoriginmobilization', + name='urlid', + field=djangoldp.fields.LDPUrlField(blank=True, db_index=True, null=True, unique=True), + ), + migrations.AlterField( + model_name='tzcldterritoriesstepstate', + name='urlid', + field=djangoldp.fields.LDPUrlField(blank=True, db_index=True, null=True, unique=True), + ), + migrations.AlterField( + model_name='tzcldterritoriesteamuserstate', + name='urlid', + field=djangoldp.fields.LDPUrlField(blank=True, db_index=True, null=True, unique=True), + ), + migrations.AlterField( + model_name='tzcldterritoriestrainingcourse', + name='urlid', + field=djangoldp.fields.LDPUrlField(blank=True, db_index=True, null=True, unique=True), + ), + migrations.AlterField( + model_name='tzcldterritoriestrainingpromotion', + name='urlid', + field=djangoldp.fields.LDPUrlField(blank=True, db_index=True, null=True, unique=True), + ), + migrations.AlterField( + model_name='tzcldterritorycirconscription', + name='urlid', + field=djangoldp.fields.LDPUrlField(blank=True, db_index=True, null=True, unique=True), + ), + migrations.AlterField( + model_name='tzcldterritorydepartment', + name='urlid', + field=djangoldp.fields.LDPUrlField(blank=True, db_index=True, null=True, unique=True), + ), + migrations.AlterField( + model_name='tzcldterritorylocation', + name='urlid', + field=djangoldp.fields.LDPUrlField(blank=True, db_index=True, null=True, unique=True), + ), + migrations.AlterField( + model_name='tzcldterritorypoliticallandscapedeputy', + name='urlid', + field=djangoldp.fields.LDPUrlField(blank=True, db_index=True, null=True, unique=True), + ), + migrations.AlterField( + model_name='tzcldterritorypoliticallandscapesenator', + name='urlid', + field=djangoldp.fields.LDPUrlField(blank=True, db_index=True, null=True, unique=True), + ), + migrations.AlterField( + model_name='tzcldterritoryprojectteammember', + name='urlid', + field=djangoldp.fields.LDPUrlField(blank=True, db_index=True, null=True, unique=True), + ), + migrations.AlterField( + model_name='tzcldterritoryregion', + name='urlid', + field=djangoldp.fields.LDPUrlField(blank=True, db_index=True, null=True, unique=True), + ), + migrations.AlterField( + model_name='tzcldterritoryrequest', + name='urlid', + field=djangoldp.fields.LDPUrlField(blank=True, db_index=True, null=True, unique=True), + ), + migrations.AlterField( + model_name='tzcldterritorysharedfile', + name='urlid', + field=djangoldp.fields.LDPUrlField(blank=True, db_index=True, null=True, unique=True), + ), + migrations.AlterField( + model_name='tzcldterritorysharednote', + name='urlid', + field=djangoldp.fields.LDPUrlField(blank=True, db_index=True, null=True, unique=True), + ), + migrations.AlterField( + model_name='tzcldterritorysynthesisfollowed', + name='urlid', + field=djangoldp.fields.LDPUrlField(blank=True, db_index=True, null=True, unique=True), + ), + migrations.AlterField( + model_name='tzcldterritorytraining', + name='urlid', + field=djangoldp.fields.LDPUrlField(blank=True, db_index=True, null=True, unique=True), + ), + ] diff --git a/djangoldp_tzcld/permissions.py b/djangoldp_tzcld/permissions.py index 4587dde..5b714df 100644 --- a/djangoldp_tzcld/permissions.py +++ b/djangoldp_tzcld/permissions.py @@ -1,9 +1,9 @@ -from djangoldp_community.permissions import CommunityPermissions +# from djangoldp_community.permissions import CommunityPermissions from django.urls import resolve from djangoldp.utils import is_authenticated_user -class TzcldCommunityProfilePermissions(CommunityPermissions): +class TzcldCommunityProfilePermissions(): filter_backends = [] def get_container_permissions(self, request, view, obj=None): -- GitLab From a6909840b1fa2cd1af14a9710705cfee2dcae619 Mon Sep 17 00:00:00 2001 From: Benoit Alessandroni <benoit@startinblox.com> Date: Tue, 16 Jan 2024 13:54:13 +0100 Subject: [PATCH 3/4] uncomment: permission --- djangoldp_tzcld/permissions.py | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/djangoldp_tzcld/permissions.py b/djangoldp_tzcld/permissions.py index 5b714df..1cfdee8 100644 --- a/djangoldp_tzcld/permissions.py +++ b/djangoldp_tzcld/permissions.py @@ -6,17 +6,17 @@ from djangoldp.utils import is_authenticated_user class TzcldCommunityProfilePermissions(): filter_backends = [] - def get_container_permissions(self, request, view, obj=None): - perms = set({'view'}) - if obj is None: - from djangoldp_community.models import Community - resolved = resolve(request.path_info) - if 'slug' in resolved.kwargs and (resolved.url_name == "tzcldcommunity-list" or - resolved.url_name == "tzcldcommunity-detail"): - community = Community.objects.get(slug=resolved.kwargs['slug']) - if is_authenticated_user(request.user) and community.members.filter(user=request.user).exists(): - if community.members.get(user=request.user).is_admin: - perms = perms.union({'add', 'change'}) - else: - return self.get_object_permissions(request, view, obj) - return perms +# def get_container_permissions(self, request, view, obj=None): +# perms = set({'view'}) +# if obj is None: +# from djangoldp_community.models import Community +# resolved = resolve(request.path_info) +# if 'slug' in resolved.kwargs and (resolved.url_name == "tzcldcommunity-list" or +# resolved.url_name == "tzcldcommunity-detail"): +# community = Community.objects.get(slug=resolved.kwargs['slug']) +# if is_authenticated_user(request.user) and community.members.filter(user=request.user).exists(): +# if community.members.get(user=request.user).is_admin: +# perms = perms.union({'add', 'change'}) +# else: +# return self.get_object_permissions(request, view, obj) +# return perms -- GitLab From bb9e120358efd6676c0b6d318a80ebb6e24bfad8 Mon Sep 17 00:00:00 2001 From: Benoit Alessandroni <benoit@startinblox.com> Date: Tue, 16 Jan 2024 15:56:57 +0100 Subject: [PATCH 4/4] fix: tzcld package with old permissions syntax --- djangoldp_tzcld/admin.py | 1 - djangoldp_tzcld/migrations/0001_initial.py | 23 ++---- .../migrations/0003_auto_20220720_1242.py | 3 +- ...cldprofilejobemail_tzcldprofilejobphone.py | 15 +--- .../migrations/0006_auto_20230327_1449.py | 26 ++----- .../migrations/0015_auto_20230330_1439.py | 3 +- .../migrations/0016_tzcldcontactmember.py | 5 +- .../migrations/0023_auto_20230524_1456.py | 27 +++---- ..._tzcldsharednote_tzcldsharednotecomment.py | 10 +-- .../migrations/0029_tzcldterritoryrequest.py | 5 +- ...ainingd_tzcldterritorysynthesisfollowed.py | 11 +-- .../migrations/0031_auto_20230706_1124.py | 17 +---- .../migrations/0033_auto_20230710_1223.py | 40 +++-------- .../migrations/0039_auto_20230711_1502.py | 5 +- .../migrations/0053_auto_20231006_1300.py | 6 +- ..._tzcldterritoriesteamuserstate_and_more.py | 18 +---- ..._tzcldterritorycirconscription_and_more.py | 6 +- djangoldp_tzcld/models.py | 72 +++++++++---------- djangoldp_tzcld/permissions.py | 22 ------ djangoldp_tzcld/views.py | 2 +- 20 files changed, 86 insertions(+), 231 deletions(-) delete mode 100644 djangoldp_tzcld/permissions.py diff --git a/djangoldp_tzcld/admin.py b/djangoldp_tzcld/admin.py index 23a6423..c693a66 100644 --- a/djangoldp_tzcld/admin.py +++ b/djangoldp_tzcld/admin.py @@ -1,7 +1,6 @@ from django.contrib import admin from djangoldp.admin import DjangoLDPAdmin from djangoldp.models import Model -#from djangoldp_tzcld.models import TzcldProfile, TzcldCommunity, TzcldTerritoriesKind, TzcldProfileOrganisation, TzcldProfileEvent, TzcldProfileRegion from djangoldp_tzcld.models import TzcldProfile, TzcldCommunity, TzcldTerritoriesKind, TzcldCommunityFollowedPointPart, TzcldCommunityFollowedPoint, TzcldCommunityEvaluationPointPart, TzcldCommunityEvaluationPoint, TzcldTerritoryRegion, TzcldProfileJob, TzcldTerritoryLocation diff --git a/djangoldp_tzcld/migrations/0001_initial.py b/djangoldp_tzcld/migrations/0001_initial.py index c72a404..6f23f64 100644 --- a/djangoldp_tzcld/migrations/0001_initial.py +++ b/djangoldp_tzcld/migrations/0001_initial.py @@ -4,7 +4,6 @@ from django.conf import settings from django.db import migrations, models import django.db.models.deletion import djangoldp.fields -import djangoldp_tzcld.permissions class Migration(migrations.Migration): @@ -36,8 +35,7 @@ class Migration(migrations.Migration): 'serializer_fields': ['@id', 'name'], 'nested_fields': [], 'depth': 0, - 'anonymous_perms': ['view'], - }, + }, ), migrations.CreateModel( name='TzcldProfile', @@ -66,13 +64,9 @@ class Migration(migrations.Migration): 'rdf_type': 'sib:CommunityTzcldProfile', 'auto_author': 'user', 'container_path': '/tzcldprofiles/', - 'permission_classes': [djangoldp_tzcld.permissions.TzcldCommunityProfilePermissions], 'serializer_fields': ['@id', 'contact_first_name', 'contact_last_name', 'kind', 'features', 'region', 'contact_mail_1', 'contact_mail_2', 'contact_mail_3', 'membership', 'last_contribution_year'], 'depth': 1, - 'anonymous_perms': ['view'], - 'authenticated_perms': ['inherit'], - 'superuser_perms': ['inherit', 'change'], - }, + }, ), migrations.CreateModel( name='TzcldProfileOrganisation', @@ -94,8 +88,7 @@ class Migration(migrations.Migration): 'serializer_fields': ['@id', 'name'], 'nested_fields': [], 'depth': 0, - 'anonymous_perms': ['view'], - }, + }, ), migrations.CreateModel( name='TzcldProfileEvent', @@ -117,8 +110,7 @@ class Migration(migrations.Migration): 'serializer_fields': ['@id', 'name'], 'nested_fields': [], 'depth': 0, - 'anonymous_perms': ['view'], - }, + }, ), migrations.CreateModel( name='TzcldCommunity', @@ -147,12 +139,9 @@ class Migration(migrations.Migration): 'default_permissions': ['add', 'change', 'delete', 'view', 'control'], 'rdf_type': 'sib:CommunityTzcldProfile', 'container_path': '/tzcldprofiles/', - 'permission_classes': [djangoldp_tzcld.permissions.TzcldCommunityProfilePermissions], + 'serializer_fields': ['@id', 'contact_first_name', 'contact_last_name', 'kind', 'features', 'region', 'contact_mail_1', 'contact_mail_2', 'contact_mail_3', 'membership', 'last_contribution_year'], 'depth': 1, - 'anonymous_perms': ['view'], - 'authenticated_perms': ['inherit', 'add'], - 'superuser_perms': ['view'], - }, + }, ), ] diff --git a/djangoldp_tzcld/migrations/0003_auto_20220720_1242.py b/djangoldp_tzcld/migrations/0003_auto_20220720_1242.py index 9b21d2f..7ae05b7 100644 --- a/djangoldp_tzcld/migrations/0003_auto_20220720_1242.py +++ b/djangoldp_tzcld/migrations/0003_auto_20220720_1242.py @@ -35,7 +35,6 @@ class Migration(migrations.Migration): 'serializer_fields': ['@id', 'name'], 'nested_fields': [], 'depth': 0, - 'anonymous_perms': ['view'], - }, + }, ), ] diff --git a/djangoldp_tzcld/migrations/0004_tzcldprofilejob_tzcldprofilejobemail_tzcldprofilejobphone.py b/djangoldp_tzcld/migrations/0004_tzcldprofilejob_tzcldprofilejobemail_tzcldprofilejobphone.py index c380760..ceb458a 100644 --- a/djangoldp_tzcld/migrations/0004_tzcldprofilejob_tzcldprofilejobemail_tzcldprofilejobphone.py +++ b/djangoldp_tzcld/migrations/0004_tzcldprofilejob_tzcldprofilejobemail_tzcldprofilejobphone.py @@ -37,10 +37,7 @@ class Migration(migrations.Migration): 'serializer_fields': ['@id', 'position', 'organistion', 'address', 'postal_code', 'city', 'departement', 'address_public'], 'nested_fields': [], 'depth': 0, - 'anonymous_perms': ['view'], - 'authenticated_perms': ['inherit'], - 'superuser_perms': ['inherit', 'change'], - }, + }, ), migrations.CreateModel( name='TzcldProfileJobPhone', @@ -64,10 +61,7 @@ class Migration(migrations.Migration): 'serializer_fields': ['@id', 'phone', 'phone_type', 'phone_public'], 'nested_fields': [], 'depth': 0, - 'anonymous_perms': ['view'], - 'authenticated_perms': ['inherit'], - 'superuser_perms': ['inherit', 'change'], - }, + }, ), migrations.CreateModel( name='TzcldProfileJobEmail', @@ -91,9 +85,6 @@ class Migration(migrations.Migration): 'serializer_fields': ['@id', 'email', 'email_type', 'email_public'], 'nested_fields': [], 'depth': 0, - 'anonymous_perms': ['view'], - 'authenticated_perms': ['inherit'], - 'superuser_perms': ['inherit', 'change'], - }, + }, ), ] diff --git a/djangoldp_tzcld/migrations/0006_auto_20230327_1449.py b/djangoldp_tzcld/migrations/0006_auto_20230327_1449.py index 225d71a..400e0c5 100644 --- a/djangoldp_tzcld/migrations/0006_auto_20230327_1449.py +++ b/djangoldp_tzcld/migrations/0006_auto_20230327_1449.py @@ -33,10 +33,7 @@ class Migration(migrations.Migration): 'serializer_fields': ['@id', 'email', 'email_type', 'email_public'], 'nested_fields': [], 'depth': 0, - 'anonymous_perms': ['view'], - 'authenticated_perms': ['inherit'], - 'superuser_perms': ['inherit', 'change'], - }, + }, ), migrations.CreateModel( name='TzcldContactPhone', @@ -59,10 +56,7 @@ class Migration(migrations.Migration): 'serializer_fields': ['@id', 'phone', 'phone_type', 'phone_public'], 'nested_fields': [], 'depth': 0, - 'anonymous_perms': ['view'], - 'authenticated_perms': ['inherit'], - 'superuser_perms': ['inherit', 'change'], - }, + }, ), migrations.CreateModel( name='TzcldJobsEmails', @@ -106,10 +100,7 @@ class Migration(migrations.Migration): 'serializer_fields': ['@id', 'name'], 'nested_fields': [], 'depth': 0, - 'anonymous_perms': ['view'], - 'authenticated_perms': ['view'], - 'superuser_perms': ['inherit', 'change'], - }, + }, ), migrations.CreateModel( name='TzcldTerritoriesEmails', @@ -149,8 +140,7 @@ class Migration(migrations.Migration): 'serializer_fields': ['@id', 'name'], 'nested_fields': [], 'depth': 0, - 'anonymous_perms': ['view'], - }, + }, ), migrations.CreateModel( name='TzcldTerritoryLocation', @@ -179,10 +169,7 @@ class Migration(migrations.Migration): 'container_path': 'tzcld-territories-location/', 'serializer_fields': ['@id', 'name', 'address', 'postal_code', 'city', 'departement', 'link', 'twitter_link', 'linkedin_link', 'phones', 'emails'], 'nested_fields': [], - 'depth': 0, - 'anonymous_perms': ['view'], - 'authenticated_perms': ['inherit', 'view', 'add', 'change'], - 'superuser_perms': ['inherit', 'change'], + 'depth': 0 }, ), migrations.CreateModel( @@ -204,8 +191,7 @@ class Migration(migrations.Migration): 'serializer_fields': ['@id', 'name'], 'nested_fields': [], 'depth': 0, - 'anonymous_perms': ['view'], - }, + }, ), migrations.RemoveField( model_name='tzcldprofilejobemail', diff --git a/djangoldp_tzcld/migrations/0015_auto_20230330_1439.py b/djangoldp_tzcld/migrations/0015_auto_20230330_1439.py index 08e32b2..5417481 100644 --- a/djangoldp_tzcld/migrations/0015_auto_20230330_1439.py +++ b/djangoldp_tzcld/migrations/0015_auto_20230330_1439.py @@ -31,8 +31,7 @@ class Migration(migrations.Migration): 'serializer_fields': ['@id', 'name'], 'nested_fields': [], 'depth': 0, - 'anonymous_perms': ['view'], - }, + }, ), migrations.AddField( model_name='tzcldcommunity', diff --git a/djangoldp_tzcld/migrations/0016_tzcldcontactmember.py b/djangoldp_tzcld/migrations/0016_tzcldcontactmember.py index bfbc9be..8da20b3 100644 --- a/djangoldp_tzcld/migrations/0016_tzcldcontactmember.py +++ b/djangoldp_tzcld/migrations/0016_tzcldcontactmember.py @@ -33,9 +33,6 @@ class Migration(migrations.Migration): 'serializer_fields': ['@id', 'member', 'is_primary'], 'nested_fields': [], 'depth': 0, - 'anonymous_perms': ['view'], - 'authenticated_perms': ['view'], - 'superuser_perms': ['inherit', 'change'], - }, + }, ), ] diff --git a/djangoldp_tzcld/migrations/0023_auto_20230524_1456.py b/djangoldp_tzcld/migrations/0023_auto_20230524_1456.py index 7fe266c..f4b4eea 100644 --- a/djangoldp_tzcld/migrations/0023_auto_20230524_1456.py +++ b/djangoldp_tzcld/migrations/0023_auto_20230524_1456.py @@ -3,7 +3,6 @@ from django.db import migrations, models import django.db.models.deletion import djangoldp.fields -import djangoldp_tzcld.permissions class Migration(migrations.Migration): @@ -33,8 +32,7 @@ class Migration(migrations.Migration): 'serializer_fields': ['@id', 'name'], 'nested_fields': [], 'depth': 0, - 'anonymous_perms': ['view'], - }, + }, ), migrations.CreateModel( name='TzcldCommunityEvaluationPoint', @@ -55,13 +53,10 @@ class Migration(migrations.Migration): 'default_permissions': ['add', 'change', 'delete', 'view', 'control'], 'rdf_type': 'tzcld:communityEvaluationPoint', 'container_path': '/tzcld-communities-evaluation-points/', - 'permission_classes': [djangoldp_tzcld.permissions.TzcldCommunityProfilePermissions], + 'serializer_fields': ['@id', 'name', 'order', 'part', 'points'], 'depth': 1, - 'anonymous_perms': ['view'], - 'authenticated_perms': ['inherit', 'add'], - 'superuser_perms': ['view'], - }, + }, ), migrations.CreateModel( name='TzcldCommunityEvaluationPointPart', @@ -86,8 +81,7 @@ class Migration(migrations.Migration): 'serializer_fields': ['@id', 'name', 'title', 'subtitle', 'order'], 'nested_fields': [], 'depth': 0, - 'anonymous_perms': ['view'], - }, + }, ), migrations.CreateModel( name='TzcldCouncilDepartmentDeliberation', @@ -108,8 +102,7 @@ class Migration(migrations.Migration): 'serializer_fields': ['@id', 'name'], 'nested_fields': [], 'depth': 0, - 'anonymous_perms': ['view'], - }, + }, ), migrations.CreateModel( name='TzcldOtherCommunityDeliberation', @@ -130,8 +123,7 @@ class Migration(migrations.Migration): 'serializer_fields': ['@id', 'name'], 'nested_fields': [], 'depth': 0, - 'anonymous_perms': ['view'], - }, + }, ), migrations.RemoveField( model_name='tzcldterritorylocation', @@ -168,13 +160,10 @@ class Migration(migrations.Migration): 'default_permissions': ['add', 'change', 'delete', 'view', 'control'], 'rdf_type': 'tzcld:communityEvaluationPointAnswer', 'container_path': '/tzcld-communities-evaluation-point-answers/', - 'permission_classes': [djangoldp_tzcld.permissions.TzcldCommunityProfilePermissions], + 'serializer_fields': ['@id', 'answer', 'comment', 'evaluation_point', 'community'], 'depth': 1, - 'anonymous_perms': ['view'], - 'authenticated_perms': ['inherit', 'add'], - 'superuser_perms': ['view'], - }, + }, ), migrations.AddField( model_name='tzcldcommunityevaluationpoint', diff --git a/djangoldp_tzcld/migrations/0028_tzcldsharednote_tzcldsharednotecomment.py b/djangoldp_tzcld/migrations/0028_tzcldsharednote_tzcldsharednotecomment.py index 53b9d02..25d21e1 100644 --- a/djangoldp_tzcld/migrations/0028_tzcldsharednote_tzcldsharednotecomment.py +++ b/djangoldp_tzcld/migrations/0028_tzcldsharednote_tzcldsharednotecomment.py @@ -35,10 +35,7 @@ class Migration(migrations.Migration): 'serializer_fields': ['@id', 'user', 'longdesc', 'tzcldCommunity'], 'nested_fields': [], 'depth': 0, - 'anonymous_perms': ['view'], - 'authenticated_perms': ['view'], - 'superuser_perms': ['inherit', 'change'], - }, + }, ), migrations.CreateModel( name='TzcldSharedNoteComment', @@ -61,9 +58,6 @@ class Migration(migrations.Migration): 'serializer_fields': ['@id', 'user', 'comment', 'tzcldSharedNote'], 'nested_fields': [], 'depth': 0, - 'anonymous_perms': ['view'], - 'authenticated_perms': ['view'], - 'superuser_perms': ['inherit', 'change'], - }, + }, ), ] diff --git a/djangoldp_tzcld/migrations/0029_tzcldterritoryrequest.py b/djangoldp_tzcld/migrations/0029_tzcldterritoryrequest.py index 0ca72d8..9ece019 100644 --- a/djangoldp_tzcld/migrations/0029_tzcldterritoryrequest.py +++ b/djangoldp_tzcld/migrations/0029_tzcldterritoryrequest.py @@ -39,9 +39,6 @@ class Migration(migrations.Migration): 'serializer_fields': ['@id', 'user', 'date', 'contactType', 'subject', 'comment', 'community'], 'nested_fields': [], 'depth': 0, - 'anonymous_perms': ['view'], - 'authenticated_perms': ['view'], - 'superuser_perms': ['inherit', 'change'], - }, + }, ), ] diff --git a/djangoldp_tzcld/migrations/0030_tzcldfollowedtrainingb_tzcldfollowedtrainingd_tzcldterritorysynthesisfollowed.py b/djangoldp_tzcld/migrations/0030_tzcldfollowedtrainingb_tzcldfollowedtrainingd_tzcldterritorysynthesisfollowed.py index c941c41..85af125 100644 --- a/djangoldp_tzcld/migrations/0030_tzcldfollowedtrainingb_tzcldfollowedtrainingd_tzcldterritorysynthesisfollowed.py +++ b/djangoldp_tzcld/migrations/0030_tzcldfollowedtrainingb_tzcldfollowedtrainingd_tzcldterritorysynthesisfollowed.py @@ -32,8 +32,7 @@ class Migration(migrations.Migration): 'serializer_fields': ['@id', 'name'], 'nested_fields': [], 'depth': 0, - 'anonymous_perms': ['view'], - }, + }, ), migrations.CreateModel( name='TzcldFollowedTrainingD', @@ -54,8 +53,7 @@ class Migration(migrations.Migration): 'serializer_fields': ['@id', 'name'], 'nested_fields': [], 'depth': 0, - 'anonymous_perms': ['view'], - }, + }, ), migrations.CreateModel( name='TzcldTerritorySynthesisFollowed', @@ -85,9 +83,6 @@ class Migration(migrations.Migration): 'serializer_fields': ['@id', 'context', 'strongPoints', 'questions', 'needs', 'targetdate', 'followedTrainingB', 'followedTrainingBNumber', 'followedTrainingD', 'followedTrainingDNumber', 'community'], 'nested_fields': [], 'depth': 0, - 'anonymous_perms': ['view'], - 'authenticated_perms': ['view'], - 'superuser_perms': ['inherit', 'change'], - }, + }, ), ] diff --git a/djangoldp_tzcld/migrations/0031_auto_20230706_1124.py b/djangoldp_tzcld/migrations/0031_auto_20230706_1124.py index a83cdb0..220c2e1 100644 --- a/djangoldp_tzcld/migrations/0031_auto_20230706_1124.py +++ b/djangoldp_tzcld/migrations/0031_auto_20230706_1124.py @@ -3,7 +3,6 @@ from django.db import migrations, models import django.db.models.deletion import djangoldp.fields -import djangoldp_tzcld.permissions class Migration(migrations.Migration): @@ -36,10 +35,7 @@ class Migration(migrations.Migration): 'container_path': 'tzcld-communities-followed-points/', 'serializer_fields': ['@id', 'name', 'order', 'part', 'fieldType', 'helpComment'], 'depth': 0, - 'anonymous_perms': ['view'], - 'authenticated_perms': ['inherit', 'add'], - 'superuser_perms': ['view'], - }, + }, ), migrations.CreateModel( name='TzcldCommunityFollowedPointPart', @@ -63,10 +59,7 @@ class Migration(migrations.Migration): 'serializer_fields': ['@id', 'name', 'title', 'order', 'followed_part_points'], 'nested_fields': [], 'depth': 0, - 'anonymous_perms': ['view'], - 'authenticated_perms': ['inherit', 'add'], - 'superuser_perms': ['view'], - }, + }, ), migrations.CreateModel( name='TzcldCommunityFollowedPointAnswer', @@ -86,13 +79,9 @@ class Migration(migrations.Migration): 'default_permissions': ['add', 'change', 'delete', 'view', 'control'], 'rdf_type': 'tzcld:communityEvaluationPointAnswer', 'container_path': 'tzcld-communities-evaluation-point-answers/', - 'permission_classes': [djangoldp_tzcld.permissions.TzcldCommunityProfilePermissions], 'serializer_fields': ['@id', 'answer', 'answer_option', 'comment', 'evaluation_point', 'community'], 'depth': 0, - 'anonymous_perms': ['view'], - 'authenticated_perms': ['inherit', 'add'], - 'superuser_perms': ['view'], - }, + }, ), migrations.AddField( model_name='tzcldcommunityfollowedpoint', diff --git a/djangoldp_tzcld/migrations/0033_auto_20230710_1223.py b/djangoldp_tzcld/migrations/0033_auto_20230710_1223.py index a720e0b..c678830 100644 --- a/djangoldp_tzcld/migrations/0033_auto_20230710_1223.py +++ b/djangoldp_tzcld/migrations/0033_auto_20230710_1223.py @@ -3,7 +3,6 @@ from django.db import migrations, models import django.db.models.deletion import djangoldp.fields -import djangoldp_tzcld.permissions class Migration(migrations.Migration): @@ -36,13 +35,9 @@ class Migration(migrations.Migration): 'default_permissions': ['add', 'change', 'delete', 'view', 'control'], 'rdf_type': 'tzcld:communityIdentity', 'container_path': 'tzcld-communities-identity/', - 'permission_classes': [djangoldp_tzcld.permissions.TzcldCommunityProfilePermissions], 'serializer_fields': ['@id', 'community', 'deputy', 'circonscription', 'origin_mobilization', 'application_date', 'signatory_structure', 'birth_date', 'last_contribution_date'], 'depth': 0, - 'anonymous_perms': ['view'], - 'authenticated_perms': ['inherit', 'add'], - 'superuser_perms': ['view'], - }, + }, ), migrations.CreateModel( name='TzcldTerritoriesOriginMobilization', @@ -63,8 +58,7 @@ class Migration(migrations.Migration): 'serializer_fields': ['@id', 'name'], 'nested_fields': [], 'depth': 0, - 'anonymous_perms': ['view'], - }, + }, ), migrations.CreateModel( name='TzcldTerritoriesTeamTrainingCourse', @@ -85,8 +79,7 @@ class Migration(migrations.Migration): 'serializer_fields': ['@id', 'name'], 'nested_fields': [], 'depth': 0, - 'anonymous_perms': ['view'], - }, + }, ), migrations.CreateModel( name='TzcldTerritoriesTeamTrainingPromotoion', @@ -107,8 +100,7 @@ class Migration(migrations.Migration): 'serializer_fields': ['@id', 'name'], 'nested_fields': [], 'depth': 0, - 'anonymous_perms': ['view'], - }, + }, ), migrations.CreateModel( name='TzcldTerritoriesTrainingCourse', @@ -129,8 +121,7 @@ class Migration(migrations.Migration): 'serializer_fields': ['@id', 'name'], 'nested_fields': [], 'depth': 0, - 'anonymous_perms': ['view'], - }, + }, ), migrations.CreateModel( name='TzcldTerritoriesTrainingProfile', @@ -151,8 +142,7 @@ class Migration(migrations.Migration): 'serializer_fields': ['@id', 'name'], 'nested_fields': [], 'depth': 0, - 'anonymous_perms': ['view'], - }, + }, ), migrations.CreateModel( name='TzcldTerritoriesTrainingPromotoion', @@ -173,8 +163,7 @@ class Migration(migrations.Migration): 'serializer_fields': ['@id', 'name'], 'nested_fields': [], 'depth': 0, - 'anonymous_perms': ['view'], - }, + }, ), migrations.CreateModel( name='TzcldTerritoryTraining', @@ -198,10 +187,7 @@ class Migration(migrations.Migration): 'container_path': 'tzcld-territories-training/', 'serializer_fields': ['@id', 'training_course', 'training_promotoion', 'training_person', 'training_profile', 'community_identity'], 'nested_fields': ['community_identity'], - 'depth': 0, - 'anonymous_perms': ['view'], - 'authenticated_perms': ['inherit', 'view', 'add', 'change'], - 'superuser_perms': ['inherit', 'view', 'add', 'change'], + 'depth': 0 }, ), migrations.CreateModel( @@ -225,10 +211,7 @@ class Migration(migrations.Migration): 'container_path': 'tzcld-territories-team-training/', 'serializer_fields': ['@id', 'training_course', 'training_promotoion', 'training_person', 'training_profile', 'community_identity'], 'nested_fields': ['community_identity'], - 'depth': 0, - 'anonymous_perms': ['view'], - 'authenticated_perms': ['inherit', 'view', 'add', 'change'], - 'superuser_perms': ['inherit', 'view', 'add', 'change'], + 'depth': 0 }, ), migrations.CreateModel( @@ -253,10 +236,7 @@ class Migration(migrations.Migration): 'container_path': 'tzcld-territories-project-team-memeber/', 'serializer_fields': ['@id', 'firstname', 'name', 'etp', 'position_funding', 'community_identity'], 'nested_fields': ['community_identity'], - 'depth': 0, - 'anonymous_perms': ['view'], - 'authenticated_perms': ['inherit', 'view', 'add', 'change'], - 'superuser_perms': ['inherit', 'view', 'add', 'change'], + 'depth': 0 }, ), migrations.AddField( diff --git a/djangoldp_tzcld/migrations/0039_auto_20230711_1502.py b/djangoldp_tzcld/migrations/0039_auto_20230711_1502.py index 0cabc01..a0b9dfd 100644 --- a/djangoldp_tzcld/migrations/0039_auto_20230711_1502.py +++ b/djangoldp_tzcld/migrations/0039_auto_20230711_1502.py @@ -40,10 +40,7 @@ class Migration(migrations.Migration): 'serializer_fields': ['@id', 'author', 'name', 'date', 'document', 'community', 'visible'], 'nested_fields': ['author', 'community'], 'depth': 0, - 'anonymous_perms': ['view'], - 'authenticated_perms': ['view'], - 'superuser_perms': ['inherit', 'change'], - }, + }, ), migrations.AddField( model_name='tzcldprofile', diff --git a/djangoldp_tzcld/migrations/0053_auto_20231006_1300.py b/djangoldp_tzcld/migrations/0053_auto_20231006_1300.py index bc6c82d..e6c82e7 100644 --- a/djangoldp_tzcld/migrations/0053_auto_20231006_1300.py +++ b/djangoldp_tzcld/migrations/0053_auto_20231006_1300.py @@ -39,11 +39,7 @@ class Migration(migrations.Migration): 'container_path': 'tzcld-territory-shared-notes/', 'serializer_fields': ['@id', 'author', 'longdesc', 'communityAdmins', 'communityReferents', 'conversations', 'date'], 'nested_fields': ['author', 'communityAdmins', 'communityReferents', 'conversations'], - 'depth': 0, - 'anonymous_perms': [], - 'authenticated_perms': ['view', 'add'], - 'owner_perms': ['inherit', 'change', 'delete'], - 'superuser_perms': ['inherit'], + 'depth': 0 }, ), migrations.DeleteModel( diff --git a/djangoldp_tzcld/migrations/0059_tzcldterritoriesteamuserstate_and_more.py b/djangoldp_tzcld/migrations/0059_tzcldterritoriesteamuserstate_and_more.py index b31d18c..e5251c8 100644 --- a/djangoldp_tzcld/migrations/0059_tzcldterritoriesteamuserstate_and_more.py +++ b/djangoldp_tzcld/migrations/0059_tzcldterritoriesteamuserstate_and_more.py @@ -34,11 +34,7 @@ class Migration(migrations.Migration): 'container_path': 'tzcld-team-user-states/', 'serializer_fields': ['@id', 'name', 'order'], 'nested_fields': [], - 'depth': 0, - 'anonymous_perms': [], - 'authenticated_perms': ['view'], - 'owner_perms': ['inherit'], - 'superuser_perms': ['inherit'], + 'depth': 0 }, ), migrations.RenameField( @@ -97,11 +93,7 @@ class Migration(migrations.Migration): 'container_path': 'tzcld-territories-political-landscape-senator/', 'serializer_fields': ['@id', 'senator', 'circonscription', 'community_identity'], 'nested_fields': ['community_identity'], - 'depth': 0, - 'anonymous_perms': [], - 'authenticated_perms': ['view', 'add'], - 'owner_perms': ['inherit', 'change', 'delete'], - 'superuser_perms': ['inherit'], + 'depth': 0 }, ), migrations.CreateModel( @@ -124,11 +116,7 @@ class Migration(migrations.Migration): 'container_path': 'tzcld-territories-political-landscape-deputy/', 'serializer_fields': ['@id', 'deputy', 'circonscription', 'community_identity'], 'nested_fields': ['community_identity'], - 'depth': 0, - 'anonymous_perms': [], - 'authenticated_perms': ['view', 'add'], - 'owner_perms': ['inherit', 'change', 'delete'], - 'superuser_perms': ['inherit'], + 'depth': 0 }, ), migrations.AddField( diff --git a/djangoldp_tzcld/migrations/0061_tzcldterritorycirconscription_and_more.py b/djangoldp_tzcld/migrations/0061_tzcldterritorycirconscription_and_more.py index 0bdda98..9c13790 100644 --- a/djangoldp_tzcld/migrations/0061_tzcldterritorycirconscription_and_more.py +++ b/djangoldp_tzcld/migrations/0061_tzcldterritorycirconscription_and_more.py @@ -31,11 +31,7 @@ class Migration(migrations.Migration): 'container_path': 'tzcld-circonscriptions/', 'serializer_fields': ['@id', 'name', 'order'], 'nested_fields': [], - 'depth': 0, - 'anonymous_perms': [], - 'authenticated_perms': ['view'], - 'owner_perms': ['inherit', 'add', 'change', 'delete'], - 'superuser_perms': ['inherit', 'change', 'delete'], + 'depth': 0 }, ), migrations.AlterModelOptions( diff --git a/djangoldp_tzcld/models.py b/djangoldp_tzcld/models.py index 49abbec..8862920 100644 --- a/djangoldp_tzcld/models.py +++ b/djangoldp_tzcld/models.py @@ -8,7 +8,6 @@ from django.utils.translation import gettext_lazy as _ from djangoldp.models import Model from djangoldp_conversation.models import Conversation, Message from djangoldp_community.models import Community, CommunityMember -# from djangoldp_tzcld.permissions import TzcldCommunityProfilePermissions ############################# # Extend user model @@ -27,7 +26,7 @@ class TzcldTerritoryCirconscription(Model): class Meta(Model.Meta): verbose_name = _('TZCLD Circonscription') verbose_name_plural = _("TZCLD Options Circonscriptions") - # anonymous_perms = [] + # authenticated_perms = ['view'] # owner_perms = ['inherit', 'add', 'change', 'delete'] # superuser_perms = ['inherit', 'change', 'delete'] @@ -50,7 +49,7 @@ class TzcldTerritoryDepartment(Model): class Meta(Model.Meta): verbose_name = _('TZCLD Department') verbose_name_plural = _("TZCLD Options Departments") - # anonymous_perms = [] + # authenticated_perms = ['view'] # owner_perms = ['inherit', 'add', 'change', 'delete'] # superuser_perms = ['inherit', 'change', 'delete'] @@ -73,7 +72,7 @@ class TzcldTerritoryRegion(Model): class Meta(Model.Meta): verbose_name = _('TZCLD Région') verbose_name_plural = _("TZCLD Régions") - # anonymous_perms = [] + # authenticated_perms = ['view'] # owner_perms = ['inherit', 'add', 'change', 'delete'] # superuser_perms = ['inherit', 'change', 'delete'] @@ -95,7 +94,7 @@ class TzcldProfilesMembership(Model): class Meta(Model.Meta): verbose_name = _('TZCLD Membership type') verbose_name_plural = _("TZCLD Options Membership types") - # anonymous_perms = [] + # authenticated_perms = ['view', 'add'] # owner_perms = ['inherit', 'change', 'delete'] # superuser_perms = ['inherit', 'change', 'delete'] @@ -128,7 +127,7 @@ class TzcldProfile(Model): class Meta(Model.Meta): verbose_name = _('TZCLD User Profile') verbose_name_plural = _("TZCLD Users Profiles") - # anonymous_perms = [] + # authenticated_perms = ['view', 'add'] # owner_perms = ['inherit', 'change', 'delete'] # superuser_perms = ['inherit', 'change', 'delete'] @@ -166,7 +165,7 @@ class TzcldProfileJob(Model): class Meta(Model.Meta): verbose_name = _('TZCLD User profile job') verbose_name_plural = _("TZCLD Users profiles jobs") - # anonymous_perms = [] + # authenticated_perms = ['view', 'add'] # owner_perms = ['inherit', 'change', 'delete'] # superuser_perms = ['inherit', 'change', 'delete'] @@ -193,7 +192,6 @@ class TzcldProfileEvent(Model): class Meta(Model.Meta): verbose_name = _('TZCLD Event') verbose_name_plural = _("TZCLD Events") - anonymous_perms = ['view'] container_path = "tzcld-events/" serializer_fields = ['@id', 'name'] nested_fields = [] @@ -213,7 +211,6 @@ class TzcldProfileOrganisation(Model): class Meta(Model.Meta): verbose_name = _('TZCLD Organisation or Territory') verbose_name_plural = _("TZCLD Organisations or Territories") - anonymous_perms = ['view'] container_path = "tzcld-orgs/" serializer_fields = ['@id', 'name'] nested_fields = [] @@ -233,7 +230,6 @@ class TzcldProfileRegion(Model): class Meta(Model.Meta): verbose_name = _('TZCLD Region or departement') verbose_name_plural = _("TZCLD Regions or departements") - anonymous_perms = ['view'] container_path = "tzcld-regions/" serializer_fields = ['@id', 'name'] nested_fields = [] @@ -256,7 +252,7 @@ class TzcldTerritoriesStepState(Model): class Meta(Model.Meta): verbose_name = _('TZCLD Territory step state') verbose_name_plural = _("TZCLD Options Territories step states") - # anonymous_perms = [] + # authenticated_perms = ['view'] # owner_perms = ['inherit'] # superuser_perms = ['inherit'] @@ -277,7 +273,7 @@ class TzcldTerritoriesKind(Model): class Meta(Model.Meta): verbose_name = _('TZCLD Territory Kind') verbose_name_plural = _("TZCLD Options Territories Kind") - # anonymous_perms = [] + # authenticated_perms = ['view'] # owner_perms = ['inherit'] # superuser_perms = ['inherit'] @@ -298,7 +294,7 @@ class TzcldTerritoriesOriginMobilization(Model): class Meta(Model.Meta): verbose_name = _('TZCLD Origin Mobilization') verbose_name_plural = _("TZCLD Options Origins Mobilization") - # anonymous_perms = [] + # authenticated_perms = ['view'] # owner_perms = ['inherit'] # superuser_perms = ['inherit'] @@ -320,7 +316,7 @@ class TzcldTerritoriesTrainingCourse(Model): class Meta(Model.Meta): verbose_name = _('TZCLD Training Course') verbose_name_plural = _("TZCLD Options Training Courses") - # anonymous_perms = [] + # authenticated_perms = ['view'] # owner_perms = ['inherit'] # superuser_perms = ['inherit'] @@ -341,7 +337,7 @@ class TzcldTerritoriesTrainingPromotion(Model): class Meta(Model.Meta): verbose_name = _('TZCLD Training Promotion') verbose_name_plural = _("TZCLD Options Training Promotions") - # anonymous_perms = [] + # authenticated_perms = ['view'] # owner_perms = ['inherit'] # superuser_perms = ['inherit'] @@ -363,7 +359,7 @@ class TzcldTerritoriesTeamUserState(Model): class Meta(Model.Meta): verbose_name = _('TZCLD Team User State') verbose_name_plural = _("TZCLD Options Team User States") - # anonymous_perms = [] + # authenticated_perms = ['view'] # owner_perms = ['inherit'] # superuser_perms = ['inherit'] @@ -395,7 +391,7 @@ class TzcldCommunity(Model): verbose_name = _('TZCLD Territory Profile') verbose_name_plural = _("TZCLD Territories Profiles") # permission_classes = [TzcldCommunityProfilePermissions] - # anonymous_perms = [] + # authenticated_perms = ['view', 'add'] # owner_perms = ['inherit', 'change', 'delete'] # superuser_perms = ['inherit'] @@ -429,7 +425,7 @@ class TzcldCommunityIdentity(Model): verbose_name = _('TZCLD Territory Identity') verbose_name_plural = _("TZCLD Territories Identities") # permission_classes = [TzcldCommunityProfilePermissions] - # anonymous_perms = [] + # authenticated_perms = ['view', 'add'] # owner_perms = ['inherit', 'change', 'delete'] # superuser_perms = ['inherit'] @@ -461,7 +457,7 @@ class TzcldTerritoryLocation(Model): class Meta(Model.Meta): verbose_name = _('TZCLD Territory location') verbose_name_plural = _("TZCLD Territories locations") - # anonymous_perms = [] + # authenticated_perms = ['view', 'add'] # owner_perms = ['inherit', 'change', 'delete'] # superuser_perms = ['inherit'] @@ -489,7 +485,7 @@ class TzcldTerritoryProjectTeamMember(Model): class Meta(Model.Meta): verbose_name = _('TZCLD Territory Project Team Member') verbose_name_plural = _("TZCLD Territories Project Team Members") - # anonymous_perms = [] + # authenticated_perms = ['view', 'add'] # owner_perms = ['inherit', 'change', 'delete'] # superuser_perms = ['inherit'] @@ -513,7 +509,7 @@ class TzcldTerritoryPoliticalLandscapeDeputy(Model): class Meta(Model.Meta): verbose_name = _('TZCLD Territory Political Landscape Deputy') verbose_name_plural = _("TZCLD Territories Political Landscape Deputies") - # anonymous_perms = [] + # authenticated_perms = ['view', 'add'] # owner_perms = ['inherit', 'change', 'delete'] # superuser_perms = ['inherit'] @@ -537,7 +533,7 @@ class TzcldTerritoryPoliticalLandscapeSenator(Model): class Meta(Model.Meta): verbose_name = _('TZCLD Territory Political Landscape Senator') verbose_name_plural = _("TZCLD Territories Political Landscape Senators") - # anonymous_perms = [] + # authenticated_perms = ['view', 'add'] # owner_perms = ['inherit', 'change', 'delete'] # superuser_perms = ['inherit'] @@ -561,7 +557,7 @@ class TzcldTerritoryTraining(Model): class Meta(Model.Meta): verbose_name = _('TZCLD Territory Training') verbose_name_plural = _("TZCLD Territories Trainings") - # anonymous_perms = [] + # authenticated_perms = ['view', 'add'] # owner_perms = ['inherit', 'change', 'delete'] # superuser_perms = ['inherit'] @@ -584,7 +580,7 @@ class TzcldCommunityDeliberation(Model): class Meta(Model.Meta): verbose_name = _('TZCLD Territory deliberation') verbose_name_plural = _("TZCLD Options Territories deliberations") - # anonymous_perms = [] + # authenticated_perms = ['view', 'add'] # owner_perms = ['inherit', 'change', 'delete'] # superuser_perms = ['inherit'] @@ -605,7 +601,7 @@ class TzcldOtherCommunityDeliberation(Model): class Meta(Model.Meta): verbose_name = _('TZCLD Other Territory deliberation') verbose_name_plural = _("TZCLD Options Other Community deliberations") - # anonymous_perms = [] + # authenticated_perms = ['view', 'add'] # owner_perms = ['inherit', 'change', 'delete'] # superuser_perms = ['inherit'] @@ -627,7 +623,7 @@ class TzcldCouncilDepartmentDeliberation(Model): class Meta(Model.Meta): verbose_name = _('TZCLD Council department deliberation') verbose_name_plural = _("TZCLD Options Council department deliberations") - # anonymous_perms = [] + # authenticated_perms = ['view', 'add'] # owner_perms = ['inherit', 'change', 'delete'] # superuser_perms = ['inherit'] @@ -651,7 +647,7 @@ class TzcldCommunityEvaluationPointPart(Model): class Meta(Model.Meta): verbose_name = _('TZCLD Territory Evaluation Point Part') verbose_name_plural = _("TZCLD Territories Evaluation Point Parts") - # anonymous_perms = [] + # authenticated_perms = ['view', 'add'] # owner_perms = ['inherit', 'change', 'delete'] # superuser_perms = ['inherit'] @@ -694,7 +690,7 @@ class TzcldCommunityEvaluationPoint(Model): class Meta(Model.Meta): verbose_name = _('TZCLD Territory Evaluation Point') verbose_name_plural = _("TZCLD Territories Evaluation Points") - # anonymous_perms = [] + # authenticated_perms = ['view', 'add'] # owner_perms = ['inherit', 'change', 'delete'] # superuser_perms = ['inherit'] @@ -728,7 +724,7 @@ class TzcldCommunityEvaluationPointAnswer(Model): verbose_name = _('TZCLD Territory Evaluation Point Answer') verbose_name_plural = _("TZCLD Territories Evaluation Point answers") # permission_classes = [TzcldCommunityProfilePermissions] - # anonymous_perms = [] + # authenticated_perms = ['view', 'add'] # owner_perms = ['inherit', 'change', 'delete'] # superuser_perms = ['inherit'] @@ -759,7 +755,7 @@ class TzcldContactPhone(Model): class Meta(Model.Meta): verbose_name = _('TZCLD Phone') verbose_name_plural = _("TZCLD Phones") - # anonymous_perms = [] + # authenticated_perms = ['view', 'add'] # owner_perms = ['inherit', 'change', 'delete'] # superuser_perms = ['inherit'] @@ -784,7 +780,7 @@ class TzcldContactEmail(Model): class Meta(Model.Meta): verbose_name = _('TZCLD Email') verbose_name_plural = _("TZCLD Emails") - # anonymous_perms = [] + # authenticated_perms = ['view', 'add'] # owner_perms = ['inherit', 'change', 'delete'] # superuser_perms = ['inherit'] @@ -812,7 +808,7 @@ class TzcldTerritoryRequest(Model): auto_author = 'author' verbose_name = _('TZCLD Territory Request') verbose_name_plural = _("TZCLD Territories Requests") - # anonymous_perms = [] + # authenticated_perms = ['view', 'add'] # owner_perms = ['inherit', 'change', 'delete'] # superuser_perms = ['inherit'] @@ -843,7 +839,7 @@ class TzcldTerritorySynthesisFollowed(Model): auto_author = 'author' verbose_name = _('TZCLD Territory Synthesis Followed') verbose_name_plural = _("TZCLD Territories Synthesis Followed") - # anonymous_perms = [] + # authenticated_perms = ['view', 'add'] # owner_perms = ['inherit', 'change', 'delete'] # superuser_perms = ['inherit'] @@ -867,7 +863,7 @@ class TzcldCommunityFollowedPointPart(Model): class Meta(Model.Meta): verbose_name = _('TZCLD Territory Followed Point Part') verbose_name_plural = _("TZCLD Territories Followed Point Parts") - # anonymous_perms = [] + # authenticated_perms = ['view', 'add'] # owner_perms = ['inherit', 'change', 'delete'] # superuser_perms = ['inherit'] @@ -906,7 +902,7 @@ class TzcldCommunityFollowedPoint(Model): class Meta(Model.Meta): verbose_name = _('TZCLD Territory Followed Point') verbose_name_plural = _("TZCLD Territories Followed Points") - # anonymous_perms = [] + # authenticated_perms = ['view', 'add'] # owner_perms = ['inherit', 'change', 'delete'] # superuser_perms = ['inherit'] @@ -936,7 +932,7 @@ class TzcldCommunityFollowedPointAnswer(Model): verbose_name = _('TZCLD Territory Followed Point Answer') verbose_name_plural = _("TZCLD Territories Followed Point answers") # permission_classes = [TzcldCommunityProfilePermissions] - # anonymous_perms = [] + # authenticated_perms = ['view', 'add'] # owner_perms = ['inherit', 'change', 'delete'] # superuser_perms = ['inherit'] @@ -965,7 +961,7 @@ class TzcldTerritorySharedNote(Model): auto_author = 'author' verbose_name = _('TZCLD Territory Shared Note') verbose_name_plural = _("TZCLD Territories Shared Notes") - # anonymous_perms = [] + # authenticated_perms = ['view', 'add'] # owner_perms = ['inherit', 'change', 'delete'] # superuser_perms = ['inherit'] @@ -994,7 +990,7 @@ class TzcldTerritorySharedFile(Model): auto_author = 'author' verbose_name = _('TZCLD Territory Shared File') verbose_name_plural = _("TZCLD Territories Shared Files") - # anonymous_perms = [] + # authenticated_perms = ['view', 'add'] # owner_perms = ['inherit', 'change', 'delete'] # superuser_perms = ['inherit'] diff --git a/djangoldp_tzcld/permissions.py b/djangoldp_tzcld/permissions.py deleted file mode 100644 index 1cfdee8..0000000 --- a/djangoldp_tzcld/permissions.py +++ /dev/null @@ -1,22 +0,0 @@ -# from djangoldp_community.permissions import CommunityPermissions -from django.urls import resolve -from djangoldp.utils import is_authenticated_user - - -class TzcldCommunityProfilePermissions(): - filter_backends = [] - -# def get_container_permissions(self, request, view, obj=None): -# perms = set({'view'}) -# if obj is None: -# from djangoldp_community.models import Community -# resolved = resolve(request.path_info) -# if 'slug' in resolved.kwargs and (resolved.url_name == "tzcldcommunity-list" or -# resolved.url_name == "tzcldcommunity-detail"): -# community = Community.objects.get(slug=resolved.kwargs['slug']) -# if is_authenticated_user(request.user) and community.members.filter(user=request.user).exists(): -# if community.members.get(user=request.user).is_admin: -# perms = perms.union({'add', 'change'}) -# else: -# return self.get_object_permissions(request, view, obj) -# return perms diff --git a/djangoldp_tzcld/views.py b/djangoldp_tzcld/views.py index f6de4df..4fa78d7 100644 --- a/djangoldp_tzcld/views.py +++ b/djangoldp_tzcld/views.py @@ -7,7 +7,7 @@ class MyTerritoriesView(LDPViewSet): parent_model = Community def get_queryset(self): user = self.request.user - return super().get_queryset().filter(Q(tzcld_profile__regions__referents=user) | Q(members__in=user.communities.filter(is_admin=True))).distinct() + return super().get_queryset().filter(Q(tzcld_profile__regions__referents=user) | Q(admins__user=user)).distinct() class MemberOfCommunitiesView(LDPViewSet): model = Community -- GitLab