add allowed users setting for current students, replace all user stuff with user dict, add beginning of vnc cleanup

This commit is contained in:
Jordan Rodgers 2018-02-14 00:57:28 -05:00
parent 6d71f49a7a
commit 7aadd423e7
10 changed files with 195 additions and 97 deletions

View file

@ -1,5 +1,6 @@
import string
import random
from proxstar.db import *
def gen_password(
@ -8,3 +9,11 @@ def gen_password(
):
# use secrets module once this works in python 3.6
return ''.join(random.choice(charset) for x in range(length))
def build_user_dict(session, db):
user_dict = dict()
user_dict['username'] = session['userinfo']['preferred_username']
user_dict['active'] = 'active' in session['userinfo']['groups'] or user_dict['username'] in get_allowed_users(db)
user_dict['rtp'] = 'rtp' in session['userinfo']['groups']
return user_dict