Modification script gestion ACLS + classe browser

This commit is contained in:
Steven Mondji-Lerider 2012-06-19 15:29:15 +00:00
parent 3d2c9b72b7
commit 2d2fef0363
2 changed files with 13 additions and 9 deletions
bureau/class
src

View File

@ -471,7 +471,7 @@ class m_bro {
* @param $verbose boolean shall we 'echo' what we did ? * @param $verbose boolean shall we 'echo' what we did ?
* @return boolean TRUE si les fichiers ont t renomms, FALSE si une erreur s'est produite. * @return boolean TRUE si les fichiers ont t renomms, FALSE si une erreur s'est produite.
*/ */
function ChangePermissions($R,$d,$perm,$verbose=true) { function ChangePermissions($R,$d,$perm,$verbose=false) {
global $err; global $err;
$absolute=$this->convertabsolute($R,0); $absolute=$this->convertabsolute($R,0);
if (!$absolute) { if (!$absolute) {
@ -544,7 +544,7 @@ class m_bro {
*/ */
function ExtractFile($file, $dest=null) function ExtractFile($file, $dest=null)
{ {
global $err; global $err,$cuid,$mem,$L_ALTERNC_LOC;
$file = $this->convertabsolute($file,0); $file = $this->convertabsolute($file,0);
if (is_null($dest)) { if (is_null($dest)) {
$dest = dirname($file); $dest = dirname($file);
@ -556,7 +556,9 @@ class m_bro {
return 1; return 1;
} }
$file = escapeshellarg($file); $file = escapeshellarg($file);
$dest = escapeshellarg($dest); $dest = escapeshellarg($dest);
$dest_to_fix=str_replace($L_ALTERNC_LOC."/html/".substr($mem->user["login"],0,1)."/".$mem->user["login"],'',$dest);
// TODO new version of tar supports `tar xf ...` so there is no // TODO new version of tar supports `tar xf ...` so there is no
// need to specify the compression format // need to specify the compression format
exec("tar -xf $file -C $dest", $void, $ret); exec("tar -xf $file -C $dest", $void, $ret);
@ -574,7 +576,9 @@ class m_bro {
if ($ret) { if ($ret) {
$err->raise("bro","could not find a way to extract file %s, unsupported format?", $file); $err->raise("bro","could not find a way to extract file %s, unsupported format?", $file);
} }
//fix the perms of the extracted archive
exec("sudo /usr/lib/alternc/fixperms.sh -u ".$cuid." -d ".$dest_to_fix);
return $ret; return $ret;
} }
@ -712,7 +716,7 @@ class m_bro {
if (substr($dir,-1)=="/") $dir=substr($dir,0,-1); if (substr($dir,-1)=="/") $dir=substr($dir,0,-1);
$dir=str_replace("%2F", "/", urlencode($dir)); $dir=str_replace("%2F", "/", urlencode($dir));
$name=urlencode($name); $name=urlencode($name);
if (!$this->cacheurl["d".$dir]) { if (!@$this->cacheurl["d".$dir]) {
// On parcours $dir en remontant les / // On parcours $dir en remontant les /
$end=""; $beg=$dir; $tofind=true; $end=""; $beg=$dir; $tofind=true;
while ($tofind) { while ($tofind) {

View File

@ -106,13 +106,13 @@ doone() {
REP="$ALTERNC_LOC/html/$INITIALE/$LOGIN/$sub_dir" REP="$ALTERNC_LOC/html/$INITIALE/$LOGIN/$sub_dir"
# Set the file readable only for the AlternC User # Set the file readable only for the AlternC User
chown -R $GID:$GID "$REP" chown -R alterncpanel:$GID "$REP"
chmod 2770 -R "$REP" chmod 2770 -R "$REP"
# Delete existings ACL # Delete existings ACL
# Set the defaults acl on all the files # Set the defaults acl on all the files
setfacl -b -k -m d:g:alterncpanel:rwx -m d:u:$GID:rw- -m d:g:$GID:rw- \ setfacl -b -k -n -R -m d:g:alterncpanel:rwx -m d:u::rwx -m d:g::rwx -m d:u:$GID:rwx -m d:g:$GID:rwx -m d:o::--- -m d:mask:rwx\
-Rm g:alterncpanel:rwx -m u:$GID:rw- -m g:$GID:rw- \ -Rm g:alterncpanel:rwx -m u:$GID:rwx -m g:$GID:rwx -m mask:rwx\
"$REP" "$REP"
read GID LOGIN read GID LOGIN
@ -124,7 +124,7 @@ fixefile(){
/usr/bin/setfacl -bk $file /usr/bin/setfacl -bk $file
echo "gid: $GID" echo "gid: $GID"
echo "file: $file" echo "file: $file"
chown $GID:$GID $file chown alterncpanel:$GID $file
chmod 0770 $file chmod 0770 $file
/usr/bin/setfacl -m u:$GID:rw- -m g:$GID:rw- -m g:alterncpanel:rw- -m u:$GID:rw- -m g:$GID:rw- $file /usr/bin/setfacl -m u:$GID:rw- -m g:$GID:rw- -m g:alterncpanel:rw- -m u:$GID:rw- -m g:$GID:rw- $file
echo file ownership and ACLs changed echo file ownership and ACLs changed