Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE
/
django-sshkey
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
A prog2-höz tartozó friss repo anyagok itt elérhetőek:
https://git.iit.bme.hu/
Commit
55490625
authored
Jul 02, 2014
by
Scott Duckworth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add setting SSHKEY_ALLOW_EDIT
parent
008ac513
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
1 deletions
+6
-1
django_sshkey/settings.py
+1
-0
django_sshkey/templates.example/sshkey/userkey_list.html
+2
-0
django_sshkey/views.py
+3
-1
No files found.
django_sshkey/settings.py
View file @
55490625
...
...
@@ -29,6 +29,7 @@
from
django.conf
import
settings
SSHKEY_AUTHORIZED_KEYS_OPTIONS
=
getattr
(
settings
,
'SSHKEY_AUTHORIZED_KEYS_OPTIONS'
,
None
)
SSHKEY_ALLOW_EDIT
=
getattr
(
settings
,
'SSHKEY_ALLOW_KEY_EDIT'
,
True
)
SSHKEY_EMAIL_ADD_KEY
=
getattr
(
settings
,
'SSHKEY_EMAIL_ADD_KEY'
,
True
)
SSHKEY_EMAIL_ADD_KEY_SUBJECT
=
getattr
(
settings
,
'SSHKEY_EMAIL_ADD_KEY_SUBJECT'
,
"A new public key was added to your account"
...
...
django_sshkey/templates.example/sshkey/userkey_list.html
View file @
55490625
...
...
@@ -14,7 +14,9 @@
<td>
{{ userkey.fingerprint }}
</td>
<td>
{{ userkey.created }}
</td>
<td>
{{ userkey.last_modified }}
</td>
{% if allow_edit %}
<td><a
href=
"{% url django_sshkey.views.userkey_edit userkey.pk %}"
>
Edit
</a></td>
{% endif %}
<td><a
href=
"{% url django_sshkey.views.userkey_delete userkey.pk %}"
>
Delete
</a></td>
</tr>
{% endfor %}
...
...
django_sshkey/views.py
View file @
55490625
...
...
@@ -68,7 +68,7 @@ def userkey_list(request):
userkey_list
=
UserKey
.
objects
.
filter
(
user
=
request
.
user
)
return
render_to_response
(
'sshkey/userkey_list.html'
,
{
'userkey_list'
:
userkey_list
},
{
'userkey_list'
:
userkey_list
,
'allow_edit'
:
settings
.
SSHKEY_ALLOW_EDIT
},
context_instance
=
RequestContext
(
request
),
)
...
...
@@ -99,6 +99,8 @@ def userkey_add(request):
@login_required
@require_http_methods
([
'GET'
,
'POST'
])
def
userkey_edit
(
request
,
pk
):
if
not
settings
.
SSHKEY_ALLOW_EDIT
:
raise
PermissionDenied
userkey
=
get_object_or_404
(
UserKey
,
pk
=
pk
)
if
userkey
.
user
!=
request
.
user
:
raise
PermissionDenied
...
...
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