예제 #1
0
def get_authenticated_user(request):
    '''
    This function is used to attach user object to current request
    '''
    userid = unauthenticated_userid(request)

    if userid is not None:
        # this should return None if the user doesn't exist
        # in the database
        return User.get_by_id(userid)
예제 #2
0
def get_principal_indentifiers(user_id, request):
    user = User.get_by_id(user_id)

    if user is None or not user.is_active:
        return

    principals = []

    if user.is_superuser:
        principals.append(SUPERUSER_PRINCIPAL)

    return principals
예제 #3
0
def get_principal_indentifiers(user_id, request):
    user = User.get_by_id(user_id)

    if user is None or not user.is_active:
        return

    principals = []

    if user.is_superuser:
        principals.append(SUPERUSER_PRINCIPAL)

    return principals