File tree Expand file tree Collapse file tree 1 file changed +15
-9
lines changed
Expand file tree Collapse file tree 1 file changed +15
-9
lines changed Original file line number Diff line number Diff line change @@ -197,23 +197,29 @@ def location(self):
197197
198198 @property
199199 def perms (self ):
200+ perms = set ()
200201 if self .is_superuser or self .is_staff :
201202 # return all permissions for admins
202- perms = PERMISSIONS .values ()
203- else :
204- user_groups = self .groups .values_list ("name" , flat = True )
205- group_perms = (
206- Permission .objects .filter (group__name__in = user_groups ).distinct ().values_list ("codename" , flat = True )
207- )
208- # return constant names defined by GeoNode
209- perms = [PERMISSIONS [db_perm ] for db_perm in group_perms ]
203+ perms .update (PERMISSIONS .values ())
204+
205+ user_groups = self .groups .values_list ("name" , flat = True )
206+ group_perms = (
207+ Permission .objects .filter (group__name__in = user_groups ).distinct ().values_list ("codename" , flat = True )
208+ )
209+ for p in group_perms :
210+ if p in PERMISSIONS :
211+ # return constant names defined by GeoNode
212+ perms .add (PERMISSIONS [p ])
213+ else :
214+ # add custom permissions
215+ perms .add (p )
210216
211217 # check READ_ONLY mode
212218 config = Configuration .load ()
213219 if config .read_only :
214220 # exclude permissions affected by readonly
215221 perms = [perm for perm in perms if perm not in READ_ONLY_AFFECTED_PERMISSIONS ]
216- return perms
222+ return list ( perms )
217223
218224 def save (self , * args , ** kwargs ):
219225 super ().save (* args , ** kwargs )
You can’t perform that action at this time.
0 commit comments