1
1
"""
2
- Functions for handling roles
2
+ Functions for handling roles.
3
3
"""
4
4
5
5
from __future__ import unicode_literals
16
16
17
17
def roles_init_new_repo (repo ):
18
18
"""
19
- Create new groups for the repository
19
+ Create new groups for the repository.
20
20
21
21
It assumes that there are only 3 types of users:
22
22
- administrator
@@ -66,7 +66,7 @@ def roles_init_new_repo(repo):
66
66
67
67
def roles_clear_repo_permissions (repo ):
68
68
"""
69
- Removes all the permissions a group has on a repo
69
+ Remove all the permissions a group has on a repository.
70
70
Args:
71
71
repo (learningresources.models.Repository): repository
72
72
Returns:
@@ -91,7 +91,7 @@ def roles_clear_repo_permissions(repo):
91
91
92
92
def roles_update_repo (repo , old_slug ):
93
93
"""
94
- Updates the groups names for the repo
94
+ Update the groups names for the repository.
95
95
96
96
Args:
97
97
repo (learningresources.models.Repository): repository used to update
@@ -128,7 +128,7 @@ def assign_user_to_repo_group(
128
128
repo ,
129
129
group_type ):
130
130
"""
131
- Assigns an user to a repo specific group type
131
+ Assign an user to a repo specific group type.
132
132
133
133
Args:
134
134
user (django.contrib.auth.models.User): user
@@ -150,7 +150,7 @@ def remove_user_from_repo_group(
150
150
repo ,
151
151
group_type ):
152
152
"""
153
- Remove an user to from a repo specific group type
153
+ Remove an user from a repository specific group type.
154
154
155
155
Args:
156
156
user (django.contrib.auth.models.User): user
@@ -169,8 +169,8 @@ def remove_user_from_repo_group(
169
169
170
170
def list_users_in_repo (repo , base_group_type = None ):
171
171
"""
172
- Lists all the users in the repository groups
173
- If the group type is specified, the list is limited to that group
172
+ List all the users in the repository groups.
173
+ If the group type is specified, the list is limited to that group.
174
174
175
175
Args:
176
176
repo (learningresources.models.Repository): repository used to extract
@@ -179,7 +179,7 @@ def list_users_in_repo(repo, base_group_type=None):
179
179
roles.permissions.BaseGroupTypes
180
180
Returns:
181
181
list (list of roles.user_models.UserGroup): list of users in one or
182
- all the repository groups
182
+ all the repository groups
183
183
"""
184
184
users_groups = []
185
185
if base_group_type is not None :
@@ -203,7 +203,7 @@ def list_users_in_repo(repo, base_group_type=None):
203
203
204
204
def is_last_admin_in_repo (user , repo ):
205
205
"""
206
- Checks if user is the last administrator in the repository.
206
+ Check if user is the last administrator in the repository.
207
207
It does not check if the user is an actual administrator and in that case
208
208
it will simply return False
209
209
0 commit comments