def new(self): """Add a new user to the auth system """ tpl.group_list = GroupMgr.get_list() tpl.form_errors = False return render('/account/new.mako')
def edit(self, user_name): """Load the edit ui for this user""" tpl.user = UserMgr.get(user_name=user_name) tpl.group_list = GroupMgr.get_list() tpl.form_errors = False for g in tpl.group_list: if g in tpl.user.groups: log.debug("IN GROUP") else: log.debug("NOT IN GROUP") self.json.success = True return render('/account/edit.mako')
def edit_error(self): """Authenticate the changes to the user account specified Currently the only changes to a user account are to assign permission groups to it. """ user_groups = request.params.getall('groups') user_name = request.params['user_name'] user = UserMgr.get(user_name=user_name) # we're admin so we're allowed to do this regardless of username user.groups = GroupMgr.get_list(user_groups) redirect(url(controller="accounts", action="list"))
def new_errors(self): """Validate a new user account details """ user = User() user.fromdict(request.params) # now make sure we create the group info # this just overwrites the from dict stuff I think user_groups = request.params.getall('groups') user.groups = GroupMgr.get_list(user_groups) try: meta.Session.add(user) #SystemLogger.log_activity('system', # None, # 'Added new user: %s to the system' % user.user_name) except: meta.Session.rollback() # @todo fill in the code to create the queued job to process this # new file we just uploaded with tons of emails to create redirect(url(controller="accounts", action="list"))