def post_edit(self, **kw): user = request.identity['user'] if request.identity else User.get_by(uid=u'@public') edited_user = User.get_by(uid=kw['uid']) if user.is_superuser: edited_user.firstname = kw['firstname'] edited_user.lastname = kw['lastname'] transaction.commit() flash('Saved (%s)' % datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')) else: flash('permission denied') redirect('../user/edit?uid=%s' % kw['uid'])
def edit(self, **kw): user = request.identity['user'] if request.identity else User.get_by(uid=u'@public') if tmpl_context.form_errors: form = EditUserForm else: if user.is_superuser: form = EditUserForm().req() form.fetch_data(request) else: form = None return dict(form=form)
def post_create(self, **kw): user = request.identity['user'] if user.admin_groups: user = User.by_uid(uid=kw['uid'], create=True) redirect('../user/create')
def user_list(): user = request.identity['user'] if request.identity else User.get_by( uid=u'@public') return [u.uid for u in User.query.all()] if user.uid != u'@public' else []
def user_list(): user = request.identity['user'] if request.identity else User.get_by(uid=u'@public') return [u.uid for u in User.query.all()] if user.uid != u'@public' else []
def get_owners(): user = request.identity['user'] if request.identity else User.get_by(uid=u'@public') return user.admin_group_names