Exemplo n.º 1
0
 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'])
Exemplo n.º 2
0
 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)
Exemplo n.º 3
0
 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')
Exemplo n.º 4
0
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 []
Exemplo n.º 5
0
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 []
Exemplo n.º 6
0
def get_owners():
    user = request.identity['user'] if request.identity else User.get_by(uid=u'@public')
    return user.admin_group_names