Skip to content

Commit

Permalink
Merge 23a7fc6 into a94169f
Browse files Browse the repository at this point in the history
  • Loading branch information
jaroel committed Apr 19, 2017
2 parents a94169f + 23a7fc6 commit 68fd250
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 8 deletions.
5 changes: 4 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ Changelog
1.0a14 (unreleased)
-------------------

- Nothing changed yet.
Bugfixes:
- The inherit flag was the wrong way around.
Blocked inherit showed up as non-blocked.
[jaroel]


1.0a13 (2017-04-18)
Expand Down
2 changes: 1 addition & 1 deletion docs/source/_json/sharing_folder_get.resp
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@ Content-Type: application/json
"type": "group"
}
],
"inherit": false
"inherit": true
}
11 changes: 8 additions & 3 deletions src/plone/restapi/serializer/local_roles.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,13 @@ def __call__(self):
name='sharing')
local_roles = sharing_view.existing_role_settings()
available_roles = [r['id'] for r in sharing_view.roles()]
return {'inherit': getattr(aq_base(self.context),
'__ac_local_roles_block__',
False),

blocked_roles = getattr(
aq_base(self.context),
'__ac_local_roles_block__',
False,
)

return {'inherit': not blocked_roles,
'entries': local_roles,
'available_roles': available_roles}
8 changes: 5 additions & 3 deletions src/plone/restapi/tests/test_content_local_roles.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def test_get_local_roles_none_assigned(self):
u'Reviewer': False},
u'title': u'Logged-in users',
u'type': u'group'}],
u'inherit': False}
u'inherit': True}
)

def test_get_local_roles_with_user(self):
Expand Down Expand Up @@ -110,7 +110,7 @@ def test_get_local_roles_with_user(self):
u'Reviewer': True},
u'title': u'test-user',
u'type': u'user'}],
u'inherit': False}
u'inherit': True}
)

def test_set_local_roles_for_user(self):
Expand Down Expand Up @@ -185,6 +185,8 @@ def test_unset_local_roles_for_user(self):
)

def test_get_local_roles_inherit_roles(self):
# __ac_local_roles_block__ specifies to block inheritance:
# https://docs.plone.org/develop/plone/security/local_roles.html
self.portal.folder1.__ac_local_roles_block__ = True
transaction.commit()

Expand All @@ -195,7 +197,7 @@ def test_get_local_roles_inherit_roles(self):
)

self.assertEqual(response.status_code, 200)
self.assertEqual(response.json()['inherit'], True)
self.assertEqual(response.json()['inherit'], False)

def test_set_local_roles_inherit(self):
self.assertEqual(self._get_ac_local_roles_block(self.portal.folder1),
Expand Down

0 comments on commit 68fd250

Please sign in to comment.