Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
itminedu
synnefo
Commits
3213b8b0
Commit
3213b8b0
authored
Jun 12, 2013
by
Kostas Papadimitriou
Browse files
astakos: Kamaki sample config file view
parent
4599c4f3
Changes
4
Hide whitespace changes
Inline
Side-by-side
snf-astakos-app/astakos/im/settings.py
View file @
3213b8b0
...
...
@@ -185,3 +185,7 @@ SKIP_EMAIL_VERIFICATION = getattr(settings,
# Kamaki download url. Displayed in api access view
API_CLIENT_URL
=
getattr
(
settings
,
'ASTAKOS_API_CLIENT_URL'
,
'https://pypi.python.org/pypi/kamaki'
)
KAMAKI_CONFIG_CLOUD_NAME
=
getattr
(
settings
,
'ASTAKOS_KAMAKI_CONFIG_CLOUD_NAME'
,
None
)
snf-astakos-app/astakos/im/templates/im/api_access_config.html
0 → 100644
View file @
3213b8b0
[global]
default_cloud = {{ cloud_name }}
[cloud "{{ cloud_name }}"]
url = {{ token_url }}
token = {{ user.auth_token }}
snf-astakos-app/astakos/im/urls.py
View file @
3213b8b0
...
...
@@ -48,6 +48,7 @@ urlpatterns = patterns(
url
(
r
'^profile/update_token?$'
,
'update_token'
,
{},
name
=
'update_token'
),
url
(
r
'^profile/?$'
,
'edit_profile'
,
{},
name
=
'edit_profile'
),
url
(
r
'^api_access/?$'
,
'api_access'
,
{},
name
=
'api_access'
),
url
(
r
'^\.kamakirc/?$'
,
'api_access_config'
,
{},
name
=
'api_access_config'
),
url
(
r
'^feedback/?$'
,
'feedback'
,
{},
name
=
'feedback'
),
url
(
r
'^signup/?$'
,
'signup'
,
{
'on_success'
:
'index'
,
'extra_context'
:
{
'login_form'
:
LoginForm
()}},
name
=
'signup'
),
url
(
r
'^logout/?$'
,
'logout'
,
{
'template'
:
'im/login.html'
,
'extra_context'
:
{
'login_form'
:
LoginForm
()}},
name
=
'logout'
),
...
...
snf-astakos-app/astakos/im/views/im.py
View file @
3213b8b0
...
...
@@ -49,6 +49,10 @@ from django.utils.translation import ugettext as _
from
django.core.exceptions
import
PermissionDenied
from
django.views.decorators.http
import
require_http_methods
from
django.utils
import
simplejson
as
json
from
django.template
import
RequestContext
from
synnefo_branding
import
utils
as
branding
from
synnefo_branding
import
settings
as
branding_settings
from
synnefo.lib
import
join_urls
...
...
@@ -62,6 +66,7 @@ from astakos.im.util import get_context, prepare_response, get_query, \
from
astakos.im.forms
import
LoginForm
,
InvitationForm
,
FeedbackForm
,
\
SignApprovalTermsForm
,
EmailChangeForm
from
astakos.im.forms
import
ExtendedProfileForm
as
ProfileForm
from
synnefo.lib.services
import
get_public_endpoint
from
astakos.im.functions
import
send_feedback
,
logout
as
auth_logout
,
\
invite
as
invite_func
from
astakos.im
import
settings
...
...
@@ -210,7 +215,42 @@ def invite(request, template_name='im/invitations.html', extra_context=None):
context_instance
=
context
)
@
require_http_methods
([
"GET"
,
"POST"
])
@
required_auth_methods_assigned
()
@
login_required
@
cookie_fix
@
signed_terms_required
def
api_access_config
(
request
,
template_name
=
'im/api_access_config.html'
,
content_type
=
'text/plain'
,
extra_context
=
None
,
filename
=
'.kamakirc'
):
if
settings
.
KAMAKI_CONFIG_CLOUD_NAME
:
cloud_name
=
settings
.
KAMAKI_CONFIG_CLOUD_NAME
else
:
cloud_name
=
branding_settings
.
SERVICE_NAME
.
replace
(
' '
,
'_'
).
lower
()
url
=
get_public_endpoint
(
settings
.
astakos_services
,
'identity'
)
context
=
{
'user'
:
request
.
user
,
'services'
:
Component
.
catalog
(),
'token_url'
:
url
,
'cloud_name'
:
cloud_name
}
extra_context
=
extra_context
or
{}
context
.
update
(
extra_context
)
content
=
branding
.
render_to_string
(
template_name
,
context
,
RequestContext
(
request
))
response
=
HttpResponse
()
response
.
status_code
=
200
response
.
content_type
=
content_type
response
[
'Content-Disposition'
]
=
'attachment; filename="%s"'
%
filename
response
.
content
=
content
return
response
@
required_auth_methods_assigned
()
@
login_required
@
cookie_fix
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment