def create(): pichayon_client = g.get_pichayon_client() rooms = pichayon_client.rooms.list() form = RoomForm() if not form.validate_on_submit(): return render_template('/dashboard/admin/rooms/create.html', form=form) room = pichayon_client.rooms.create(**form.data) if room.is_error: return render_template('/dashboard/admin/rooms/create.html', form=form) return redirect(url_for('web.dashboard.admin.rooms.index'))
def get_user_and_remember(oauth2_token): pichayon_client = g.get_pichayon_client() result = pichayon_client.authenticate(oauth2_token) pichayon_client.access_token = result.access_token user = pichayon_client.users.get(result.user['id']) user = acl.User(profile=user.data, oauth2_token=oauth2_token, token=result.data) session[user.id] = user.to_session_dict() login_user(user)
def create(): form = GroupForm() if not form.validate_on_submit(): return render_template('/dashboard/admin/groups/create.html', form=form) pichayon_client = g.get_pichayon_client() group = pichayon_client.groups.create(**form.data) if group.is_error: return render_template('/dashboard/admin/groups/create.html', form=form) return redirect(url_for('web.dashboard.admin.groups.index'))
def update(room_id): pichayon_client = g.get_pichayon_client() room = pichayon_client.rooms.get(room_id) form = RoomForm(obj=room) if not form.validate_on_submit(): return render_template('/dashboard/admin/rooms/create.html', form=form) room = Room(id=room_id, **form.data) room = pichayon_client.rooms.update(room) if room.is_error: return render_template('/dashboard/admin/rooms/create.html', form=form) return redirect(url_for('web.dashboard.admin.rooms.index'))
def create(): pichayon_client = g.get_pichayon_client() users = pichayon_client.groups.list() form = UserForm() if not form.validate_on_submit(): return render_template('/dashboard/admin/users/create.html', form=form) user = pichayon_client.users.create(**form.data) if user.is_error: return render_template('/dashboard/admin/users/create.html', form=form) return redirect(url_for('web.dashboard.admin.users.index'))
def update(user_id): pichayon_client = g.get_pichayon_client() user = pichayon_client.users.get(user_id) form = RoomForm(obj=user) if not form.validate_on_submit(): return render_template('/dashboard/admin/users/create.html', form=form) user = Room(id=user_id, **form.data) user = pichayon_client.users.update(user) if user.is_error: return render_template('/dashboard/admin/users/create.html', form=form) return redirect(url_for('web.dashboard.admin.users.index'))
def update(group_id): pichayon_client = g.get_pichayon_client() group = pichayon_client.groups.get(group_id) form = GroupForm(obj=group) if not form.validate_on_submit(): return render_template('/dashboard/admin/groups/create.html', form=form) group = Group(id=group_id, **form.data) group = pichayon_client.groups.update(group) if group.is_error: return render_template('/dashboard/admin/groups/create.html', form=form) return redirect(url_for('web.dashboard.admin.groups.index'))
def delete(room_id): pichayon_client = g.get_pichayon_client() pichayon_client.rooms.delete(room_id) return redirect(url_for('web.dashboard.admin.rooms.index'))
def index(): pichayon_client = g.get_pichayon_client() rooms = pichayon_client.rooms.list() return render_template('/dashboard/admin/rooms/index.html', rooms=rooms)
def index(): pichayon_client = g.get_pichayon_client() users = pichayon_client.users.list() return render_template('/dashboard/admin/users/index.html', users=users)
def index(): pichayon_client = g.get_pichayon_client() groups = pichayon_client.groups.list() return render_template('/dashboard/admin/groups/index.html', groups=groups)