def get_context_data(self, **kwargs): auth = UserCredentials() context = {} context = super(CurrentUserMixin, self).get_context_data(**kwargs) context['user_full_name'] = auth.get_FirstName( ) + " " + auth.get_LastName() context['user_ounetid'] = auth.get_OUNetID() context['user_email'] = auth.get_Email() for membership in auth.MemberOf: context['user_is_' + str(membership.lower())] = True context['user_is_admin'] = auth.is_admin() context['user_groups'] = auth.MemberOf context['server_type'] = settings.SERVER_TYPE return context
def wrap(request, *args, **kwargs): creds = UserCredentials() if creds.is_member(groups) or creds.is_admin(): return function(request, *args, **kwargs) else: raise PermissionDenied
def can_delete(self, user_obj): creds = UserCredentials() return self.created_by == creds.get_OUNetID() or creds.is_admin()