예제 #1
0
def login_user(request, user_data):
    request.security = Interaction(request)
    participation = GuillotinaParticipation(request)
    participation.interaction = None

    if 'id' in user_data:
        user = GuillotinaUser(request)
        user.id = user_data['id']
        user._groups = user_data.get('groups', [])
        user._roles = user_data.get('roles', [])
        user.data = user_data.get('data', {})
        participation.principal = user
        request._cache_user = user

    request.security.add(participation)
    request.security.invalidate_cache()
    request._cache_groups = {}
    if user_data.get('Authorization'):
        request.headers['Authorization'] = user_data['Authorization']
예제 #2
0
 def __init__(self, conn=None):
     self.security = Interaction(self)
     self.headers = {}
     self._txn_dm = conn
예제 #3
0
def login(request, user=RootUser('foobar')):
    request.security = Interaction(request)
    request.security.add(TestParticipation(request, user))
    request.security.invalidate_cache()
    request._cache_groups = {}
예제 #4
0
def login(request):
    request.security = Interaction(request)
    request.security.add(TestParticipation(request))
    request.security.invalidate_cache()
    request._cache_groups = {}