Skip to content
This repository has been archived by the owner on Apr 9, 2023. It is now read-only.

Commit

Permalink
only trigger if we modify permissions on the object
Browse files Browse the repository at this point in the history
  • Loading branch information
Ramon Navarro Bosch committed Feb 13, 2017
1 parent a0ab75d commit 2153a9c
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/plone.server/plone/server/api/content.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,10 @@ async def sharing_post(context, request):

setting = data['type']

# we need to check if we are changing any info

changed = False

if 'prinrole' in data:
if setting not in PermissionMap['prinrole']:
raise AttributeError('Invalid Type')
Expand All @@ -261,6 +265,7 @@ async def sharing_post(context, request):
for user, roles in data['prinrole'].items():
for role in roles:
if role in lroles:
changed = True
func(role, user)
else:
raise KeyError('No valid local role')
Expand All @@ -273,6 +278,7 @@ async def sharing_post(context, request):
func = getattr(manager, operation)
for user, permissions in data['prinperm'].items():
for permision in permissions:
changed = True
func(permision, user)

if 'roleperm' in data:
Expand All @@ -283,9 +289,11 @@ async def sharing_post(context, request):
func = getattr(manager, operation)
for role, permissions in data['roleperm'].items():
for permission in permissions:
changed = True
func(permission, role)

await notify(ObjectPermissionsModifiedEvent(context, data))
if changed:
await notify(ObjectPermissionsModifiedEvent(context, data))


@configure.service(
Expand Down

0 comments on commit 2153a9c

Please sign in to comment.