Skip to content

Commit a294807

Browse files
committed
Changed implementation of can_manage_all_groups_of_type to use GroupFeatures.groupman_authroles. Commit ready for merge.
- Legacy-Id: 19259
1 parent 359889c commit a294807

1 file changed

Lines changed: 3 additions & 13 deletions

File tree

ietf/group/utils.py

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -105,27 +105,17 @@ def save_milestone_in_history(milestone):
105105

106106
return h
107107

108-
# TODO: rework this using features.groupman_authroles
109108
def can_manage_all_groups_of_type(user, type_id):
110109
if not user.is_authenticated:
111110
return False
112111
log.assertion("isinstance(type_id, (type(''), type(u'')))")
113-
if type_id == "rg":
114-
return has_role(user, ('IRTF Chair', 'Secretariat'))
115-
elif type_id == "wg":
116-
return has_role(user, ('Area Director', 'Secretariat'))
117-
elif type_id == "team":
118-
return has_role(user, ('Area Director', 'Secretariat'))
119-
elif type_id == "program":
120-
return has_role(user, ('IAB', 'Secretariat',))
121-
return has_role(user, ('Secretariat'))
112+
return has_role(user, GroupFeatures.objects.get(type_id=type_id).groupman_authroles)
122113

123114
def can_manage_group(user, group):
124115
if not user.is_authenticated:
125116
return False
126-
for authrole in group.features.groupman_authroles:
127-
if has_role(user, authrole):
128-
return True
117+
if has_role(user, group.features.groupman_authroles):
118+
return True
129119
return group.has_role(user, group.features.groupman_roles)
130120

131121
def milestone_reviewer_for_group_type(group_type):

0 commit comments

Comments
 (0)