Statistics
| Branch: | Tag: | Revision:

root / snf-astakos-app / astakos / api / user.py @ f6ff3033

History | View | Annotate | Download (2.7 kB)

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