예제 #1
0
파일: views.py 프로젝트: ebgcdev/lemur
    def put(self, domain_id):
        """
        .. http:get:: /domains/1

           update one domain

           **Example request**:

           .. sourcecode:: http

              GET /domains HTTP/1.1
              Host: example.com
              Accept: application/json, text/javascript

              {
                  "name": "www.example.com",
                  "sensitive": false
              }

           **Example response**:

           .. sourcecode:: http

              HTTP/1.1 200 OK
              Vary: Accept
              Content-Type: text/javascript

              {
                  "id": 1,
                  "name": "www.example.com",
                  "sensitive": false
              }

           :reqheader Authorization: OAuth token to authenticate
           :statuscode 200: no error
           :statuscode 403: unauthenticated
        """
        self.reqparse.add_argument('name', type=str, location='json')
        self.reqparse.add_argument('sensitive',
                                   type=bool,
                                   default=False,
                                   location='json')
        args = self.reqparse.parse_args()

        if SensitiveDomainPermission().can():
            return service.update(domain_id, args['name'], args['sensitive'])

        return dict(
            message='You are not authorized to modify this domain'), 403
예제 #2
0
파일: views.py 프로젝트: CameronNemo/lemur
    def put(self, domain_id):
        """
        .. http:get:: /domains/1

           update one domain

           **Example request**:

           .. sourcecode:: http

              GET /domains HTTP/1.1
              Host: example.com
              Accept: application/json, text/javascript

              {
                  "name": "www.example.com",
                  "sensitive": false
              }

           **Example response**:

           .. sourcecode:: http

              HTTP/1.1 200 OK
              Vary: Accept
              Content-Type: text/javascript

              {
                  "id": 1,
                  "name": "www.example.com",
                  "sensitive": false
              }

           :reqheader Authorization: OAuth token to authenticate
           :statuscode 200: no error
           :statuscode 403: unauthenticated
        """
        self.reqparse.add_argument("name", type=str, location="json")
        self.reqparse.add_argument("sensitive", type=bool, default=False, location="json")
        args = self.reqparse.parse_args()

        if SensitiveDomainPermission().can():
            return service.update(domain_id, args["name"], args["sensitive"])

        return dict(message="You are not authorized to modify this domain"), 403
예제 #3
0
    def put(self, domain_id, data=None):
        """
        .. http:get:: /domains/1

           update one domain

           **Example request**:

           .. sourcecode:: http

              GET /domains HTTP/1.1
              Host: example.com
              Accept: application/json, text/javascript

              {
                  "name": "www.example.com",
                  "sensitive": false
              }

           **Example response**:

           .. sourcecode:: http

              HTTP/1.1 200 OK
              Vary: Accept
              Content-Type: text/javascript

              {
                  "id": 1,
                  "name": "www.example.com",
                  "sensitive": false
              }

           :reqheader Authorization: OAuth token to authenticate
           :statuscode 200: no error
           :statuscode 403: unauthenticated
        """
        if SensitiveDomainPermission().can():
            return service.update(domain_id, data["name"], data["sensitive"])

        return dict(
            message="You are not authorized to modify this domain"), 403
예제 #4
0
    def put(self, domain_id, data=None):
        """
        .. http:get:: /domains/1

           update one domain

           **Example request**:

           .. sourcecode:: http

              GET /domains HTTP/1.1
              Host: example.com
              Accept: application/json, text/javascript

              {
                  "name": "www.example.com",
                  "sensitive": false
              }

           **Example response**:

           .. sourcecode:: http

              HTTP/1.1 200 OK
              Vary: Accept
              Content-Type: text/javascript

              {
                  "id": 1,
                  "name": "www.example.com",
                  "sensitive": false
              }

           :reqheader Authorization: OAuth token to authenticate
           :statuscode 200: no error
           :statuscode 403: unauthenticated
        """
        if SensitiveDomainPermission().can():
            return service.update(domain_id, data['name'], data['sensitive'])

        return dict(message='You are not authorized to modify this domain'), 403