コード例 #1
0
 def delete(self, robot_shortname):
     """
     Delete an existing robot.
     """
     parent = get_authenticated_user()
     model.delete_robot(format_robot_username(parent.username, robot_shortname))
     log_action("delete_robot", parent.username, {"robot": robot_shortname})
     return "", 204
コード例 #2
0
    def delete(self, orgname, robot_shortname):
        """ Delete an existing organization robot. """
        permission = AdministerOrganizationPermission(orgname)
        if permission.can():
            model.delete_robot(format_robot_username(orgname, robot_shortname))
            log_action("delete_robot", orgname, {"robot": robot_shortname})
            return "", 204

        raise Unauthorized()
コード例 #3
0
    def delete(self, orgname, robot_shortname):
        """
        Delete an existing organization robot.
        """
        permission = AdministerOrganizationPermission(orgname)
        if permission.can():
            robot_username = format_robot_username(orgname, robot_shortname)
            if not model.robot_has_mirror(robot_username):
                model.delete_robot(robot_username)
                log_action("delete_robot", orgname, {"robot": robot_shortname})
                return "", 204
            else:
                raise request_error(message="Robot is being used by a mirror")

        raise Unauthorized()
コード例 #4
0
    def delete(self, robot_shortname):
        """
        Delete an existing robot.
        """
        parent = get_authenticated_user()
        robot_username = format_robot_username(parent.username,
                                               robot_shortname)

        if not model.robot_has_mirror(robot_username):
            model.delete_robot(robot_username)
            log_action("delete_robot", parent.username,
                       {"robot": robot_shortname})
            return "", 204
        else:
            raise request_error(message="Robot is being used by a mirror")