Example #1
0
 def updateRepos(self, user):
     if not self._userIsAdmin():
         return self.writeErrorPage("Access denied.")
     if not self.userDB.userExists(user): return
     rdw_spider_repos.findReposForUser(user, self.userDB)
     return self.writeMessagePage("Success",
                                  "Successfully updated repositories.")
 def _updateRepos(self):
    rdw_spider_repos.findReposForUser(self.getUsername(), self.getUserDB())
    return self._getPrefsPage(statusMessage="Successfully updated backup locations.")
 def _updateRepos(self):
    rdw_spider_repos.findReposForUser(self.getUsername(), self.userDB)
    return self._getPrefsPage(statusMessage="Successfully updated backup locations.")
Example #4
0
 def updateRepos(self):
     rdw_spider_repos.findReposForUser(self.getUsername(), self.userDB)
     return self.getPrefsPage(
         statusMessage="Successfully updated repositories.")
Example #5
0
    def _users_handle_action(self, action, username, email, password,
                             user_root, is_admin):

        success = ""
        warning = ""

        # We need to change values. Change them, then give back that main
        # page again, with a message
        if username == self.getUsername():
            # Don't allow the user to changes it's "admin" state.
            is_admin = self.getUserDB().is_admin(username)

        # Fork the behaviour according to the action.
        if action == "edit":
            self._check_user_exists(username)
            logger.info("updating user info")
            if password:
                self.getUserDB().set_password(username, None, password)
            self.getUserDB().set_info(username, user_root, is_admin)
            self.getUserDB().set_email(username, email)
            success = _("User information modified successfully.")

            # Check and update user directory
            try:
                self._check_user_root_dir(user_root)
                rdw_spider_repos.findReposForUser(username,
                                                  self.getUserDB())
            except ValueError as e:
                success = ""
                warning = unicode(e)

        elif action == "add":

            if self.getUserDB().exists(username):
                raise ValueError("The specified user already exists.")
            elif username == "":
                raise ValueError("The username is invalid.")
            logger.info("adding user [%s]" % username)
            self.getUserDB().add_user(username)
            self.getUserDB().set_password(username, None, password)
            self.getUserDB().set_info(username, user_root, is_admin)
            self.getUserDB().set_email(username, email)

            # Check and update user directory
            try:
                self._check_user_root_dir(user_root)
                rdw_spider_repos.findReposForUser(username,
                                                  self.getUserDB())
            except ValueError as e:
                warning = unicode(e)
            success = "User added successfully."

        if action == "delete":

            self._check_user_exists(username)
            if username == self.getUsername():
                raise ValueError("You cannot remove your own account!.")
            logger.info("deleting user [%s]" % username)
            self.getUserDB().delete_user(username)
            success = "User account removed."

        # Return messages
        return {'success': success,
                'warning': warning}
 def updateRepos(self, user):
    if not self._userIsAdmin(): return self.writeErrorPage("Access denied.")
    if not self.userDB.userExists(user): return
    rdw_spider_repos.findReposForUser(user, self.userDB)
    return self.writeMessagePage("Success", "Successfully updated repositories.")
Example #7
0
 def _update_repos(self):
     rdw_spider_repos.findReposForUser(self.getUsername(), self.getUserDB())
     return {'success': """Successfully updated repositories."""}
 def updateRepos(self):
    rdw_spider_repos.findReposForUser(self.getUsername(), self.userDB)
    return self.getPrefsPage(statusMessage="Successfully updated repositories.")
Example #9
0
 def _updateRepos(self):
    rdw_spider_repos.findReposForUser(self.getUsername(), self.getUserDB())
    return self._getPrefsPage(statusMessage="Carpetas actualizadas.")