Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
3pia
VISPA
VISPA web
Commits
deb0a238
Commit
deb0a238
authored
Aug 16, 2017
by
Benjamin Fischer
Browse files
Filesystem: partially updated ACL handling
- added retrieval of NFSv4 ACLs - added retrieval of all user & groups
parent
e79e5f77
Changes
2
Hide whitespace changes
Inline
Side-by-side
vispa/controller/filesystem.py
View file @
deb0a238
...
...
@@ -481,6 +481,14 @@ class FSAjaxController(AbstractController):
path
=
fs
.
expand
(
path
)
return
list
(
fs
.
getfacl
(
path
))
@
cherrypy
.
expose
@
cherrypy
.
tools
.
method
(
accept
=
"GET"
)
def
getuserandgroupids
(
self
):
self
.
release_session
()
fs
=
self
.
get
(
"fs"
)
self
.
release_database
()
return
fs
.
get_user_and_group_ids
()
@
cherrypy
.
expose
@
cherrypy
.
tools
.
method
(
accept
=
"POST"
)
def
setfacl
(
self
,
path
,
type
,
name
,
mode
,
remove
=
False
,
recursive
=
False
,
default
=
False
):
...
...
vispa/remote/filesystem.py
View file @
deb0a238
...
...
@@ -62,6 +62,8 @@ import subprocess
import
fsmonitor
import
vispa
import
tempfile
from
pwd
import
getpwall
from
grp
import
getgrall
try
:
import
Image
...
...
@@ -524,15 +526,24 @@ class FileSystem(object):
return
os
.
access
(
path
,
permission
)
def
getfacl
(
self
,
path
):
o
=
check_output
([
"getfacl"
,
"-p"
,
"-t"
,
path
])
facls
=
[]
for
line
in
o
.
splitlines
():
if
not
line
:
continue
if
line
.
startswith
(
"#"
):
continue
e
=
line
.
split
()
if
e
[
0
]
in
[
"mask"
,
"other"
]:
e
[
1
:
1
]
=
[
""
]
facls
.
append
(
tuple
(
e
))
return
facls
path
=
self
.
expand
(
path
)
s
=
os
.
stat
(
path
)
ret
=
dict
(
stat
=
dict
((
k
[
3
:],
getattr
(
s
,
k
))
for
k
in
dir
(
s
)
if
k
.
startswith
(
"st_"
)))
try
:
ret
[
"facl"
]
=
list
(
check_output
([
"getfacl"
,
"-pc"
,
path
]).
splitlines
())
except
CalledProcessError
:
pass
try
:
ret
[
"nfs4_facl"
]
=
list
(
check_output
([
"nfs4_getfacl"
,
path
]).
splitlines
())
except
CalledProcessError
:
pass
return
ret
def
get_user_and_group_ids
(
self
):
return
dict
(
users
=
dict
((
s
.
pw_name
,
s
.
pw_uid
)
for
s
in
getpwall
()),
groups
=
dict
((
s
.
gr_name
,
s
.
gr_gid
)
for
s
in
getgrall
()),
)
def
setfacl
(
self
,
path
,
type
,
name
,
mode
,
remove
=
False
,
recursive
=
False
,
default
=
False
):
if
type
not
in
(
"user"
,
"group"
,
"mask"
,
"other"
):
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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