Пример #1
0
    def delete(self, user_name):
        """Remove a user from the system if this is an admin

        :param user_name: the user to remove from the system

        """
        user = UserMgr.get(user_name=user_name)
        meta.Session.delete(user)
        redirect(url(controller="accounts", action="list"))
Пример #2
0
    def delete(self, user_name):
        """Remove a user from the system if this is an admin

        :param user_name: the user to remove from the system

        """
        user = UserMgr.get(user_name=user_name)
        meta.Session.delete(user)
        redirect(url(controller="accounts", action="list"))
Пример #3
0
    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')
Пример #4
0
    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')
Пример #5
0
    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"))
Пример #6
0
    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"))