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
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()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment