Skip to content
Snippets Groups Projects
Commit d3ef5a17 authored by Tanner Prestegard's avatar Tanner Prestegard Committed by GraceDB
Browse files

Add 'is_internal' utility for checking user memberships

parent f96b0397
No related branches found
No related tags found
No related merge requests found
from django.conf import settings
from .utils import is_internal
def LigoAuthContext(request):
user_is_internal = False
user_is_lvem = False
user_is_advocate = False # user is an EM advocate
if request.user:
if request.user.groups.filter(name=settings.LVC_GROUP).exists():
if is_internal(request.user):
user_is_internal = True
if request.user.groups.filter(name=settings.LVEM_GROUP).exists():
user_is_lvem = True
......
from django.conf import settings
from django.http import HttpResponseForbidden
from django.utils.functional import wraps
def groups_allowed(group_names):
"""
Decorator to allow access to specified group(s).
......@@ -23,3 +25,6 @@ def groups_allowed(group_names):
return wrapper
return decorator
def is_internal(user):
return user.groups.filter(name=settings.LVC_GROUP).exists()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment