Edgewall Software

Opened 7 years ago

Closed 7 years ago

Last modified 4 years ago

#12915 closed enhancement (fixed)

Add method to PermissionSystem for retrieving user groups — at Version 2

Reported by: Ryan J Ollos Owned by: Ryan J Ollos
Priority: normal Milestone: 1.3.3
Component: general Version:
Severity: normal Keywords: permissions
Cc: Branch:
Release Notes:

Added PermissionSystem.get_user_groups(username), which returns a sorted list of all groups that username belongs to.

API Changes:
Internal Changes:

Description

I have wanted a method of PermissionSystem for retrieving all groups that a user belongs to, both those defined in the permissions table and in IPermissionGroupProviders.

Change History (3)

by Ryan J Ollos, 7 years ago

Attachment: privateticketsplugin.diff added

comment:1 by Ryan J Ollos, 7 years ago

Proposed changes in [3fdd6a387/rjollos.git]. Example use: privateticketsplugin.diff.

  1. get_user_permissions is similarly named, but returns a dictionary. I have never understood the usefulness of mapping all the keys to True, so I chose to return a sorted list from get_user_groups.
  2. get_user_permissions returns all permissions when username is None. The same can't easily be done for get_user_groups because IPermissionGroupProviders don't return all groups when username is None. I'm not even sure we'd want that behavior for DefaultPermissionGroupProvider. We'd probably need to add a get_all_groups method to the IPermissionGroupProvider interface.
  3. get_groups_dict doesn't really return all groups, because it doesn't account for IPermissionGroupProviders. We'd probably need the DefaultPermissionGroupProvider.get_all_groups method for it to return all groups. This could be considered a defect in group expansion of the set_owner field.
Last edited 6 years ago by Ryan J Ollos (previous) (diff)

comment:2 by Ryan J Ollos, 7 years ago

Release Notes: modified (diff)
Resolution: fixed
Status: assignedclosed

Committed to trunk in r16326.

Note: See TracTickets for help on using tickets.