Skip to content

Improvements on core.authorization and permission backend#714

Merged
leplatrem merged 11 commits intomasterfrom
optimization-permissions-backend
Jul 18, 2016
Merged

Improvements on core.authorization and permission backend#714
leplatrem merged 11 commits intomasterfrom
optimization-permissions-backend

Conversation

@leplatrem
Copy link
Contributor

@leplatrem leplatrem commented Jul 12, 2016

  • Refactor and simplify permissions methods to get rid of the callback get_bound_permissions
  • Rework get_accessible_objects() to obtain every objects in a single call (c.f. GET /permissions endpoint)
  • Add get_objects_permissions() to retrieve the permissions set for a list of objects ids
  • Update changelog
  • Make tests pass

@leplatrem leplatrem force-pushed the optimization-permissions-backend branch from 9acd0ff to 74af727 Compare July 13, 2016 14:11
@leplatrem leplatrem changed the title [WIP] Improvements on permission backend Improvements on permission backend Jul 13, 2016
@leplatrem leplatrem mentioned this pull request Jul 13, 2016
12 tasks
self.get_prefixed_userid = functools.partial(prefixed_userid, request)

self._check_permission = request.registry.permission.check_permission
permission = request.registry.permission
Copy link
Contributor Author

Choose a reason for hiding this comment

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

nit: move above

@leplatrem
Copy link
Contributor Author

@Natim feedback?

@Natim
Copy link
Member

Natim commented Jul 13, 2016

I've read the code I understand that rather than using the get_bound_permissions function you prepare it and then you pass its result.

I think I would need some more explanation but it seems a good refactor to me.

@leplatrem
Copy link
Contributor Author

using the get_bound_permissions function you prepare it and then you pass its result.

yes, that is it! actually, each backend implementation was resolving the result of this callback the same way! so it makes much more sense to call it before leveraging the backends. It makes the code simpler to read IMO.

Plus, it gives us a consistent way of fetching the permissions for several objects, necessary for #653 and #694 :) Win-Win :)

@leplatrem leplatrem changed the title Improvements on permission backend Improvements on core.authorization and permission backend Jul 14, 2016
@leplatrem
Copy link
Contributor Author

@Natim
Copy link
Member

Natim commented Jul 18, 2016

r+

@leplatrem leplatrem merged commit ae8fbea into master Jul 18, 2016
@leplatrem leplatrem deleted the optimization-permissions-backend branch July 18, 2016 07:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants