Revision 7763f5c6
b/snf-astakos-app/astakos/im/settings.py | ||
---|---|---|
180 | 180 |
# Do not require email verification for new users |
181 | 181 |
SKIP_EMAIL_VERIFICATION = getattr(settings, |
182 | 182 |
'ASTAKOS_SKIP_EMAIL_VERIFICATION', False) |
183 |
|
|
184 |
# Kamaki download url. Displayed in api access view |
|
185 |
API_CLIENT_URL = getattr(settings, 'ASTAKOS_API_CLIENT_URL', |
|
186 |
'https://pypi.python.org/pypi/kamaki') |
b/snf-astakos-app/astakos/im/static/im/css/formating.css | ||
---|---|---|
113 | 113 |
|
114 | 114 |
/* heading extra */ |
115 | 115 |
h2 .header-actions { float: right; font-size: 0.8em;} |
116 |
|
|
117 |
.api-access-view div.detail .title { |
|
118 |
float: left; |
|
119 |
font-size: 0.8em; |
|
120 |
} |
|
121 |
|
|
122 |
.api-access-view div.detail input { |
|
123 |
border: none; |
|
124 |
text-decoration: none; |
|
125 |
width: 80%; |
|
126 |
font-family: monospace; |
|
127 |
position: absolute; |
|
128 |
left: 20%; |
|
129 |
cursor: pointer; |
|
130 |
} |
|
131 |
|
|
132 |
.api-access-view div.detail { |
|
133 |
display: block; |
|
134 |
position: relative; |
|
135 |
margin: 1em 0; |
|
136 |
font-size: 1.3em; |
|
137 |
cursor: pointer; |
|
138 |
border-bottom: 1px solid #efefef; |
|
139 |
padding-bottom: 0.2em; |
|
140 |
} |
|
141 |
|
|
142 |
.api-access-view div.detail.small { |
|
143 |
padding-bottom: 0.9em; |
|
144 |
} |
|
145 |
|
|
146 |
.api-access-view div.detail .expires { |
|
147 |
font-size: 9px; |
|
148 |
font-family: 'Open Sans', sans-serif; |
|
149 |
position: absolute; |
|
150 |
right: 0; |
|
151 |
bottom: 15px; |
|
152 |
} |
|
153 |
|
|
154 |
.api-access-view p.sub { |
|
155 |
font-size: 0.7em; |
|
156 |
text-align: right; |
|
157 |
} |
|
158 |
|
|
159 |
.api-access-view .api-clients h3 { |
|
160 |
font-size: 1.2em; |
|
161 |
} |
|
162 |
|
|
163 |
.subsection { |
|
164 |
margin-bottom: 4em; |
|
165 |
} |
b/snf-astakos-app/astakos/im/static/im/js/common.js | ||
---|---|---|
87 | 87 |
|
88 | 88 |
$(document).ready(function() { |
89 | 89 |
|
90 |
/* api access */ |
|
91 |
$(".token-view .detail").click(function() { |
|
92 |
$(this).find("input").select(); |
|
93 |
}); |
|
94 |
|
|
90 | 95 |
|
91 | 96 |
setContainerMinHeight('.container .wrapper'); |
92 | 97 |
//tableFixedCols('my-projects', 25); |
... | ... | |
404 | 409 |
/* end of project members page js */ |
405 | 410 |
|
406 | 411 |
|
407 |
|
|
408 |
|
|
409 | 412 |
}); |
410 | 413 |
|
411 | 414 |
$(window).resize(function() { |
b/snf-astakos-app/astakos/im/templates/im/api_access.html | ||
---|---|---|
1 |
{% extends "im/account_base.html" %}
|
|
1 |
{% extends "im/api_access_base.html" %}
|
|
2 | 2 |
|
3 |
{% load filters %} |
|
4 |
|
|
5 |
{% block page.body %} |
|
6 |
<h2>API ACCESS</h2> |
|
7 |
|
|
8 |
<p>Sed ut perspiciatis, unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam eaque ipsa, quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt, explicabo. Nemo enim ipsam voluptatem, quia voluptas sit, aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos, qui ratione voluptatem sequi nesciunt, neque porro quisquam est, qui dolorem ipsum, quia dolor sit amet, consectetur, adipisci[ng] velit, sed quia non numquam [do] eius modi tempora inci[di]dunt, ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit, qui in ea voluptate velit esse, quam nihil molestiae consequatur, vel illum, qui dolorem eum fugiat, quo voluptas nulla pariatur?</p> |
|
9 |
|
|
10 |
{% endblock %} |
b/snf-astakos-app/astakos/im/templates/im/api_access_base.html | ||
---|---|---|
1 |
{% extends "im/account_base.html" %} |
|
2 |
{% load filters %} |
|
3 |
|
|
4 |
{% block page.body %} |
|
5 |
<div class="api-access-view"> |
|
6 |
<div class="subsection"> |
|
7 |
{% block page.body.title %} |
|
8 |
<h2>API ACCESS</h2> |
|
9 |
{% endblock %} |
|
10 |
{% block page.body.description %} |
|
11 |
<p> |
|
12 |
<em>{{ BRANDING_SERVICE_NAME }} API</em> allows you complete access to all |
|
13 |
of your data stored accross the {{ BRANDING_SERVICE_NAME }} services. |
|
14 |
</p> |
|
15 |
{% endblock %} |
|
16 |
</div> |
|
17 |
|
|
18 |
<div class="subsection"> |
|
19 |
{% block page.body.token %} |
|
20 |
<h2>API details</h2> |
|
21 |
<div class="token-view"> |
|
22 |
<div class="detail clearfix"> |
|
23 |
<span class="title">Account UUID</span> |
|
24 |
<input type="text" value="{{ request.user.uuid }}" disabled /> |
|
25 |
</div> |
|
26 |
<div class="detail small clearfix"> |
|
27 |
<span class="title">Authentication url</span> |
|
28 |
<input type="text" value="{{ token_url }}" disabled /> |
|
29 |
</div> |
|
30 |
<div class="detail clearfix"> |
|
31 |
<span class="title">API Token</span> |
|
32 |
<input type="text" value="{{ request.user.auth_token }}" disabled /> |
|
33 |
<span class="expires"> |
|
34 |
<span class="date"> |
|
35 |
expires in {{ request.user.auth_token_expires|timeuntil }} |
|
36 |
({{ request.user.auth_token_expires|date }}) |
|
37 |
</span> |
|
38 |
</span> |
|
39 |
<span class="extra-img" id="token-span"> </span> |
|
40 |
</div> |
|
41 |
<p class="sub">Make sure to set the new token in any client you may be using each |
|
42 |
time you renew your token.</p> |
|
43 |
</div> |
|
44 |
{% endblock %} |
|
45 |
</div> |
|
46 |
|
|
47 |
<div class="subsection api-clients"> |
|
48 |
{% block page.body.clients %} |
|
49 |
<h2>Command line client</h2> |
|
50 |
<h3><a href="{{ client_url }}">Kamaki</a></h3> |
|
51 |
<p> |
|
52 |
Kamaki is a command line utility that fully supports the |
|
53 |
{{ BRANDNING_SERVICE_NAME }} API. |
|
54 |
</p> |
|
55 |
<p class="download">You can download kamaki |
|
56 |
from the <a href="{{ client_url }}">project homepage</a></p> |
|
57 |
{% endblock %} |
|
58 |
</div> |
|
59 |
</div> |
|
60 |
{% endblock %} |
b/snf-astakos-app/astakos/im/urls.py | ||
---|---|---|
47 | 47 |
url(r'^landing/?$', 'landing', {}, name='landing'), |
48 | 48 |
url(r'^profile/update_token?$', 'update_token', {}, name='update_token'), |
49 | 49 |
url(r'^profile/?$','edit_profile', {}, name='edit_profile'), |
50 |
url(r'^api_access/?$','api_access', {}, name='api_access'), |
|
50 | 51 |
url(r'^api_access/?$', 'api_access', {}, name='api_access'), |
51 | 52 |
url(r'^feedback/?$', 'feedback', {}, name='feedback'), |
52 | 53 |
url(r'^signup/?$', 'signup', {'on_success': 'index', 'extra_context': {'login_form': LoginForm()}}, name='signup'), |
b/snf-astakos-app/astakos/im/views/im.py | ||
---|---|---|
51 | 51 |
from django.views.decorators.http import require_http_methods |
52 | 52 |
from django.utils import simplejson as json |
53 | 53 |
|
54 |
from synnefo.lib import join_urls |
|
55 |
|
|
54 | 56 |
import astakos.im.messages as astakos_messages |
55 | 57 |
|
56 | 58 |
from astakos.im import activation_backends |
... | ... | |
203 | 205 |
|
204 | 206 |
|
205 | 207 |
@require_http_methods(["GET", "POST"]) |
208 |
@required_auth_methods_assigned() |
|
209 |
@login_required |
|
210 |
@cookie_fix |
|
211 |
@signed_terms_required |
|
212 |
def api_access(request, template_name='im/api_access.html', |
|
213 |
extra_context=None): |
|
214 |
""" |
|
215 |
API access view. |
|
216 |
""" |
|
217 |
context = {} |
|
218 |
|
|
219 |
token_url = join_urls(settings.BASE_URL, settings.BASE_PATH, |
|
220 |
reverse('tokens_authenticate')) |
|
221 |
context['services'] = Component.catalog() |
|
222 |
context['token_url'] = token_url |
|
223 |
context['client_url'] = settings.API_CLIENT_URL |
|
224 |
|
|
225 |
if extra_context: |
|
226 |
context.update(extra_context) |
|
227 |
context_instance = get_context(request, context) |
|
228 |
return render_response(template_name, |
|
229 |
context_instance=context_instance) |
|
230 |
|
|
231 |
|
|
232 |
@require_http_methods(["GET", "POST"]) |
|
206 | 233 |
@required_auth_methods_assigned(allow_access=True) |
207 | 234 |
@login_required |
208 | 235 |
@cookie_fix |
... | ... | |
811 | 838 |
context_instance=get_context(request), **context) |
812 | 839 |
|
813 | 840 |
|
814 |
def api_access(request): |
|
815 |
return render_response( |
|
816 |
'im/api_access.html', |
|
817 |
context_instance=get_context(request)) |
|
818 |
|
|
819 | 841 |
@cookie_fix |
820 | 842 |
def get_menu(request, with_extra_links=False, with_signout=True): |
821 | 843 |
user = request.user |
... | ... | |
843 | 865 |
append(item(url=request.build_absolute_uri(reverse('invite')), |
844 | 866 |
name="Invitations")) |
845 | 867 |
|
868 |
append(item(url=request.build_absolute_uri(reverse('api_access')), |
|
869 |
name="API access")) |
|
870 |
|
|
846 | 871 |
append(item(url=request.build_absolute_uri(reverse('resource_usage')), |
847 | 872 |
name="Usage")) |
848 | 873 |
|
Also available in: Unified diff