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']
def __init__(self, conn=None): self.security = Interaction(self) self.headers = {} self._txn_dm = conn
def login(request, user=RootUser('foobar')): request.security = Interaction(request) request.security.add(TestParticipation(request, user)) request.security.invalidate_cache() request._cache_groups = {}
def login(request): request.security = Interaction(request) request.security.add(TestParticipation(request)) request.security.invalidate_cache() request._cache_groups = {}