Statistics
| Branch: | Tag: | Revision:

root / snf-astakos-app / astakos / api / service.py @ b2b32926

History | View | Annotate | Download (2.7 kB)

1 bd40abfa Christos Stavrakakis
# Copyright 2011-2013 GRNET S.A. All rights reserved.
2 6b03a847 Sofia Papagiannaki
#
3 6b03a847 Sofia Papagiannaki
# Redistribution and use in source and binary forms, with or
4 6b03a847 Sofia Papagiannaki
# without modification, are permitted provided that the following
5 6b03a847 Sofia Papagiannaki
# conditions are met:
6 6b03a847 Sofia Papagiannaki
#
7 6b03a847 Sofia Papagiannaki
#   1. Redistributions of source code must retain the above
8 6b03a847 Sofia Papagiannaki
#      copyright notice, this list of conditions and the following
9 6b03a847 Sofia Papagiannaki
#      disclaimer.
10 6b03a847 Sofia Papagiannaki
#
11 6b03a847 Sofia Papagiannaki
#   2. Redistributions in binary form must reproduce the above
12 6b03a847 Sofia Papagiannaki
#      copyright notice, this list of conditions and the following
13 6b03a847 Sofia Papagiannaki
#      disclaimer in the documentation and/or other materials
14 6b03a847 Sofia Papagiannaki
#      provided with the distribution.
15 6b03a847 Sofia Papagiannaki
#
16 6b03a847 Sofia Papagiannaki
# THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
17 6b03a847 Sofia Papagiannaki
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 6b03a847 Sofia Papagiannaki
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19 6b03a847 Sofia Papagiannaki
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
20 6b03a847 Sofia Papagiannaki
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 6b03a847 Sofia Papagiannaki
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 6b03a847 Sofia Papagiannaki
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
23 6b03a847 Sofia Papagiannaki
# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
24 6b03a847 Sofia Papagiannaki
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 6b03a847 Sofia Papagiannaki
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
26 6b03a847 Sofia Papagiannaki
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27 6b03a847 Sofia Papagiannaki
# POSSIBILITY OF SUCH DAMAGE.
28 6b03a847 Sofia Papagiannaki
#
29 6b03a847 Sofia Papagiannaki
# The views and conclusions contained in the software and
30 6b03a847 Sofia Papagiannaki
# documentation are those of the authors and should not be
31 6b03a847 Sofia Papagiannaki
# interpreted as representing official policies, either expressed
32 6b03a847 Sofia Papagiannaki
# or implied, of GRNET S.A.
33 6b03a847 Sofia Papagiannaki
34 6b03a847 Sofia Papagiannaki
from django.views.decorators.csrf import csrf_exempt
35 6b03a847 Sofia Papagiannaki
36 ee7a2b87 Christos Stavrakakis
from snf_django.lib import api
37 6b03a847 Sofia Papagiannaki
38 7f313da1 Sofia Papagiannaki
from .util import (
39 7f313da1 Sofia Papagiannaki
    get_uuid_displayname_catalogs as get_uuid_displayname_catalogs_util,
40 7f313da1 Sofia Papagiannaki
    send_feedback as send_feedback_util,
41 bea584e1 Giorgos Korfiatis
    component_from_token)
42 7f313da1 Sofia Papagiannaki
43 ee7a2b87 Christos Stavrakakis
import logging
44 6b03a847 Sofia Papagiannaki
logger = logging.getLogger(__name__)
45 6b03a847 Sofia Papagiannaki
46 5ce3ce4f Sofia Papagiannaki
47 890c2065 Sofia Papagiannaki
@csrf_exempt
48 ee7a2b87 Christos Stavrakakis
@api.api_method(http_method='POST', token_required=True, user_required=False,
49 79b5d61b Sofia Papagiannaki
                logger=logger)
50 bea584e1 Giorgos Korfiatis
@component_from_token  # Authenticate service !!
51 890c2065 Sofia Papagiannaki
def get_uuid_displayname_catalogs(request):
52 6b03a847 Sofia Papagiannaki
    # Normal Response Codes: 200
53 6b03a847 Sofia Papagiannaki
    # Error Response Codes: internalServerError (500)
54 6b03a847 Sofia Papagiannaki
    #                       badRequest (400)
55 6b03a847 Sofia Papagiannaki
    #                       unauthorised (401)
56 7f313da1 Sofia Papagiannaki
    return get_uuid_displayname_catalogs_util(request, user_call=False)
57 5ce3ce4f Sofia Papagiannaki
58 bd40abfa Christos Stavrakakis
59 6b03a847 Sofia Papagiannaki
@csrf_exempt
60 ee7a2b87 Christos Stavrakakis
@api.api_method(http_method='POST', token_required=True, user_required=False,
61 79b5d61b Sofia Papagiannaki
                logger=logger)
62 bea584e1 Giorgos Korfiatis
@component_from_token  # Authenticate service !!
63 6b03a847 Sofia Papagiannaki
def send_feedback(request, email_template_name='im/feedback_mail.txt'):
64 6b03a847 Sofia Papagiannaki
    # Normal Response Codes: 200
65 6b03a847 Sofia Papagiannaki
    # Error Response Codes: internalServerError (500)
66 6b03a847 Sofia Papagiannaki
    #                       badRequest (400)
67 6b03a847 Sofia Papagiannaki
    #                       unauthorised (401)
68 e1feace1 Giorgos Korfiatis
    return send_feedback_util(request, email_template_name)