Skip to content

Commit

Permalink
Merge pull request #321 from plone/fix-revoke-users
Browse files Browse the repository at this point in the history
Fix an AttributeError in `api.user.revoke_roles`
  • Loading branch information
gforcada committed Oct 29, 2016
2 parents 841f9a2 + 3a530d2 commit 58e49e7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions docs/CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ Changelog
------------------

Fixes:
- Fix an AttributeError in `api.user.revoke_roles`
[ale-rt]

- Remove print statements and use @security decorators to make
code-analysis happy.
Expand Down
3 changes: 2 additions & 1 deletion src/plone/api/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,8 @@ def revoke_roles(username=None, user=None, obj=None, roles=None):
if obj is not None:
# if obj, get only a list of local roles, without inherited ones
inherit = False
actual_roles = get_roles(user=user, obj=obj, inherit=inherit)

actual_roles = list(get_roles(user=user, obj=obj, inherit=inherit))
if actual_roles.count('Anonymous'):
actual_roles.remove('Anonymous')
if actual_roles.count('Authenticated'):
Expand Down

1 comment on commit 58e49e7

@jenkins-plone-org
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gforcada Jenkins CI reporting about code analysis
See the full report here: http://jenkins.plone.org/job/package-plone.api/85/violations

src/plone/api/content.py:268:1: C901 'delete' is too complex (15)
src/plone/api/content.py:360:1: C901 '_wf_transitions_for' is too complex (13)
src/plone/api/content.py:425:1: C901 'transition' is too complex (13)
src/plone/api/tests/test_doctests.py:0:1: I001 isort found changes, run it on the file

Follow these instructions to reproduce it locally.

Please sign in to comment.