Commit 8108796f authored by Sofia Papagiannaki's avatar Sofia Papagiannaki
Browse files

Add owner as a project member in case of closed join policy

parent 90e5b3ce
...@@ -1492,8 +1492,6 @@ class ProjectMembership(models.Model): ...@@ -1492,8 +1492,6 @@ class ProjectMembership(models.Model):
raise PermissionDenied(_(astakos_messages.NOT_ALLOWED)) raise PermissionDenied(_(astakos_messages.NOT_ALLOWED))
if not self.project.is_alive: if not self.project.is_alive:
raise PermissionDenied(_(astakos_messages.NOT_ALIVE_PROJECT) % self.project.__dict__) raise PermissionDenied(_(astakos_messages.NOT_ALIVE_PROJECT) % self.project.__dict__)
if self.project.definition.member_join_policy == 'closed':
raise PermissionDenied(_(astakos_messages.MEMBER_JOIN_POLICY_CLOSED))
if len(self.project.approved_members) + 1 > self.project.definition.limit_on_members_number: if len(self.project.approved_members) + 1 > self.project.definition.limit_on_members_number:
raise PermissionDenied(_(astakos_messages.MEMBER_NUMBER_LIMIT_REACHED)) raise PermissionDenied(_(astakos_messages.MEMBER_NUMBER_LIMIT_REACHED))
except PermissionDenied, e: except PermissionDenied, e:
...@@ -1740,6 +1738,8 @@ pre_save.connect(renew_token, sender=Service) ...@@ -1740,6 +1738,8 @@ pre_save.connect(renew_token, sender=Service)
def check_closed_join_membership_policy(sender, instance, **kwargs): def check_closed_join_membership_policy(sender, instance, **kwargs):
if instance.id: if instance.id:
return return
if instance.person == instance.project.application.owner:
return
join_policy = instance.project.application.definition.member_join_policy join_policy = instance.project.application.definition.member_join_policy
if join_policy == get_closed_join(): if join_policy == get_closed_join():
raise PermissionDenied(_(astakos_messages.MEMBER_JOIN_POLICY_CLOSED)) raise PermissionDenied(_(astakos_messages.MEMBER_JOIN_POLICY_CLOSED))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment