Skip to content

Commit

Permalink
Add AUTHORIZED_GROUPS to BaseWidget
Browse files Browse the repository at this point in the history
  • Loading branch information
UmSenhorQualquer committed Feb 19, 2019
1 parent 27b157c commit e038340
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pyforms_web/basewidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ class BaseWidget(object):
#: str: Time in milliseconds to refresh the application.
REFRESH_TIMEOUT = None

#: list(str): List of django groups authorized to run the application
AUTHORIZED_GROUPS = None

#: str: Css classes to add to the form.
CSS = ''

Expand Down Expand Up @@ -632,7 +635,7 @@ def has_permissions(cls, user):
:param User params: User to availuate the permissions.
"""
if hasattr(cls, 'AUTHORIZED_GROUPS'):
if hasattr(cls, 'AUTHORIZED_GROUPS') and cls.AUTHORIZED_GROUPS is not None:
if user.is_superuser and 'superuser' in cls.AUTHORIZED_GROUPS:
return True
if user.groups.filter(name__in=cls.AUTHORIZED_GROUPS).exists():
Expand Down

0 comments on commit e038340

Please sign in to comment.