Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Fukász Rómeó Ervin
/
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
47c0dcd0
authored
Feb 06, 2013
by
Guba Sándor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
store-server: Added New Folder command proper permissions
parent
39621075
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
4 deletions
+5
-4
miscellaneous/store-server/CloudStore.py
+5
-4
No files found.
miscellaneous/store-server/CloudStore.py
View file @
47c0dcd0
...
@@ -165,7 +165,7 @@ def cmd_rename(request, neptun, home_path):
...
@@ -165,7 +165,7 @@ def cmd_rename(request, neptun, home_path):
COMMANDS
[
'RENAME'
]
=
cmd_rename
COMMANDS
[
'RENAME'
]
=
cmd_rename
# NEW FOLDER
# NEW FOLDER
def
cmd_new_folder
(
request
,
neptun
,
home_path
):
def
cmd_new_folder
(
request
,
username
,
home_path
):
dir_path
=
home_path
+
'/'
+
request
.
json
[
'PATH'
]
dir_path
=
home_path
+
'/'
+
request
.
json
[
'PATH'
]
dir_path
=
os
.
path
.
realpath
(
dir_path
)
dir_path
=
os
.
path
.
realpath
(
dir_path
)
if
not
dir_path
.
startswith
(
home_path
):
if
not
dir_path
.
startswith
(
home_path
):
...
@@ -174,6 +174,7 @@ def cmd_new_folder(request, neptun, home_path):
...
@@ -174,6 +174,7 @@ def cmd_new_folder(request, neptun, home_path):
abort
(
400
,
"Directory already exist!"
)
abort
(
400
,
"Directory already exist!"
)
else
:
else
:
os
.
mkdir
(
dir_path
,
0755
)
os
.
mkdir
(
dir_path
,
0755
)
os
.
chown
(
dir_path
,
getpwnam
(
username
)
.
pw_uid
,
getpwnam
(
username
)
.
pw_gid
)
COMMANDS
[
'NEW_FOLDER'
]
=
cmd_new_folder
COMMANDS
[
'NEW_FOLDER'
]
=
cmd_new_folder
# REMOVE
# REMOVE
...
@@ -295,13 +296,13 @@ def upload(hash_num):
...
@@ -295,13 +296,13 @@ def upload(hash_num):
# Check if file exist (root can overwrite anything not safe)
# Check if file exist (root can overwrite anything not safe)
with
open
(
up_path
,
'wb'
)
as
f
:
with
open
(
up_path
,
'wb'
)
as
f
:
datalength
=
0
datalength
=
0
for
chunk
in
fbuffer
(
file_data
.
file
):
for
chunk
in
fbuffer
(
file_data
.
file
,
chunk_size
=
1048576
):
f
.
write
(
chunk
)
f
.
write
(
chunk
)
datalength
+=
len
(
chunk
)
datalength
+=
len
(
chunk
)
os
.
chown
(
up_path
,
getpwnam
(
username
)
.
pw_uid
,
getpwnam
(
username
)
.
pw_gid
)
os
.
chmod
(
up_path
,
0644
)
try
:
try
:
redirect_address
=
request
.
headers
.
get
(
'Referer'
)
redirect_address
=
request
.
headers
.
get
(
'Referer'
)
os
.
chown
(
up_path
,
getpwnam
(
username
)
.
pw_uid
,
getpwnam
(
username
)
.
pw_gid
)
os
.
chmod
(
up_path
,
0644
)
except
:
except
:
redirect_address
=
REDIRECT_URL
redirect_address
=
REDIRECT_URL
response
.
set_header
(
'Access-Control-Allow-Origin'
,
'*'
)
response
.
set_header
(
'Access-Control-Allow-Origin'
,
'*'
)
...
...
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