Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gelencsér Szabolcs
/
cloud
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
Commit
e51fd4a8
authored
Feb 04, 2013
by
Dányi Bence
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
ssh://giccero.cloud.ik.bme.hu/cloud
parents
96f1b1e0
8347df83
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
25 additions
and
4 deletions
+25
-4
school/views.py
+2
-0
store/api.py
+11
-0
store/static/store/gui.js
+2
-1
store/templates/store/list.html
+5
-1
store/views.py
+5
-2
No files found.
school/views.py
View file @
e51fd4a8
...
@@ -23,6 +23,7 @@ from one.models import *
...
@@ -23,6 +23,7 @@ from one.models import *
from
school.models
import
*
from
school.models
import
*
import
django.contrib.auth
as
auth
import
django.contrib.auth
as
auth
import
logging
import
logging
from
django.views.decorators.csrf
import
ensure_csrf_cookie
logger
=
logging
.
getLogger
(
__name__
)
logger
=
logging
.
getLogger
(
__name__
)
...
@@ -30,6 +31,7 @@ def logout(request):
...
@@ -30,6 +31,7 @@ def logout(request):
auth
.
logout
(
request
)
auth
.
logout
(
request
)
return
redirect
(
'/Shibboleth.sso/Logout?return=https
%3
a
%2
f
%2
fcloud.ik.bme.hu
%2
f'
)
return
redirect
(
'/Shibboleth.sso/Logout?return=https
%3
a
%2
f
%2
fcloud.ik.bme.hu
%2
f'
)
@ensure_csrf_cookie
def
login
(
request
):
def
login
(
request
):
try
:
try
:
user
=
User
.
objects
.
get
(
username
=
request
.
META
[
'niifPersonOrgID'
])
user
=
User
.
objects
.
get
(
username
=
request
.
META
[
'niifPersonOrgID'
])
...
...
store/api.py
View file @
e51fd4a8
...
@@ -16,6 +16,9 @@ class StoreApi:
...
@@ -16,6 +16,9 @@ class StoreApi:
# ssl_auth = True
# ssl_auth = True
# verify_ssl = False
# verify_ssl = False
@staticmethod
@staticmethod
def
get_host
():
return
settings
[
'store_host'
]
@staticmethod
def
post_request
(
url
,
payload
):
def
post_request
(
url
,
payload
):
headers
=
{
'content-type'
:
'application/json'
}
headers
=
{
'content-type'
:
'application/json'
}
if
settings
[
'ssl_auth'
]
==
'True'
and
settings
[
'basic_auth'
]
==
'True'
:
if
settings
[
'ssl_auth'
]
==
'True'
and
settings
[
'basic_auth'
]
==
'True'
:
...
@@ -126,6 +129,14 @@ class StoreApi:
...
@@ -126,6 +129,14 @@ class StoreApi:
else
:
else
:
return
False
return
False
@staticmethod
@staticmethod
def
requestquota
(
neptun
):
url
=
settings
[
'store_url'
]
+
'/'
+
neptun
r
=
StoreApi
.
get_request
(
url
)
if
r
.
status_code
==
requests
.
codes
.
ok
:
return
json
.
loads
(
r
.
content
)
else
:
return
False
@staticmethod
def
userexist
(
neptun
):
def
userexist
(
neptun
):
url
=
settings
[
'store_url'
]
+
'/'
+
neptun
url
=
settings
[
'store_url'
]
+
'/'
+
neptun
r
=
StoreApi
.
get_request
(
url
)
r
=
StoreApi
.
get_request
(
url
)
...
...
store/static/store/gui.js
View file @
e51fd4a8
...
@@ -22,7 +22,8 @@ function postKey(key) {
...
@@ -22,7 +22,8 @@ function postKey(key) {
function
(
respond
)
{
function
(
respond
)
{
alert
(
respond
);
alert
(
respond
);
}
}
);
)
.
error
(
function
(
respond
)
{
alert
(
JSON
.
stringify
(
respond
));
});
}
}
function
resetKey
()
{
function
resetKey
()
{
$
.
post
(
"/store/gui/"
,
""
,
$
.
post
(
"/store/gui/"
,
""
,
...
...
store/templates/store/list.html
View file @
e51fd4a8
...
@@ -8,7 +8,11 @@
...
@@ -8,7 +8,11 @@
<input
type=
"hidden"
name=
"auth"
value=
"True"
>
<input
type=
"hidden"
name=
"auth"
value=
"True"
>
</form>
</form>
</td>
</td>
<td></td>
<td>
{% for k,v in quota.items %}
{{ k }} : {{ v }}
{% endfor %}
</td>
<td></td>
<td></td>
<td>
<td>
<form
action=
"/store/"
method=
"POST"
<form
action=
"/store/"
method=
"POST"
...
...
store/views.py
View file @
e51fd4a8
# Create your views here.
# Create your views here.
from
django.core.context_processors
import
csrf
from
django.http
import
HttpResponse
from
django.http
import
HttpResponse
from
django.shortcuts
import
render_to_response
,
redirect
from
django.shortcuts
import
render_to_response
,
redirect
from
django.template
import
RequestContext
from
django.template
import
RequestContext
...
@@ -78,7 +79,8 @@ def index(request):
...
@@ -78,7 +79,8 @@ def index(request):
#Normalize path (Need double dirname /folder/ -> /folder -> /
#Normalize path (Need double dirname /folder/ -> /folder -> /
backpath
=
os
.
path
.
normpath
(
os
.
path
.
dirname
(
os
.
path
.
dirname
(
path
)))
backpath
=
os
.
path
.
normpath
(
os
.
path
.
dirname
(
os
.
path
.
dirname
(
path
)))
file_list
=
StoreApi
.
listfolder
(
user
,
path
)
file_list
=
StoreApi
.
listfolder
(
user
,
path
)
return
render_to_response
(
'store/list.html'
,
RequestContext
(
request
,
{
'file_list'
:
file_list
,
'path'
:
path
,
'backpath'
:
backpath
,
'username'
:
user
}))
quota
=
StoreApi
.
requestquota
(
user
)
return
render_to_response
(
'store/list.html'
,
RequestContext
(
request
,
{
'file_list'
:
file_list
,
'path'
:
path
,
'backpath'
:
backpath
,
'username'
:
user
,
'quota'
:
quota
}))
@login_required
@login_required
def
ajax_listfolder
(
request
):
def
ajax_listfolder
(
request
):
...
@@ -145,10 +147,11 @@ def toplist(request):
...
@@ -145,10 +147,11 @@ def toplist(request):
file_list
=
StoreApi
.
toplist
(
user
)
file_list
=
StoreApi
.
toplist
(
user
)
return
render_to_response
(
'store/list.html'
,
RequestContext
(
request
,
{
'file_list'
:
file_list
,
'path'
:
path
,
'backpath'
:
backpath
,
'username'
:
user
}))
return
render_to_response
(
'store/list.html'
,
RequestContext
(
request
,
{
'file_list'
:
file_list
,
'path'
:
path
,
'backpath'
:
backpath
,
'username'
:
user
}))
@login_required
def
gui
(
request
):
def
gui
(
request
):
user
=
request
.
user
.
username
user
=
request
.
user
.
username
if
request
.
method
==
'GET'
:
if
request
.
method
==
'GET'
:
return
render_to_response
(
'store/gui.html'
,
RequestContext
(
request
,
{
'username'
:
user
,
'host'
:
'10.9.1.86'
}))
return
render_to_response
(
'store/gui.html'
,
RequestContext
(
request
,
{
'username'
:
user
,
'host'
:
StoreApi
.
get_host
()
}))
elif
request
.
method
==
'POST'
:
elif
request
.
method
==
'POST'
:
try
:
try
:
details
=
request
.
user
.
userclouddetails_set
.
all
()[
0
]
details
=
request
.
user
.
userclouddetails_set
.
all
()[
0
]
...
...
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