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

View File

@ -471,7 +471,7 @@ class m_bro {
* @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.
*/
function ChangePermissions($R,$d,$perm,$verbose=true) {
function ChangePermissions($R,$d,$perm,$verbose=false) {
global $err;
$absolute=$this->convertabsolute($R,0);
if (!$absolute) {
@ -544,7 +544,7 @@ class m_bro {
*/
function ExtractFile($file, $dest=null)
{
global $err;
global $err,$cuid,$mem,$L_ALTERNC_LOC;
$file = $this->convertabsolute($file,0);
if (is_null($dest)) {
$dest = dirname($file);
@ -557,6 +557,8 @@ class m_bro {
}
$file = escapeshellarg($file);
$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
// need to specify the compression format
exec("tar -xf $file -C $dest", $void, $ret);
@ -575,6 +577,8 @@ class m_bro {
$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;
}
@ -712,7 +716,7 @@ class m_bro {
if (substr($dir,-1)=="/") $dir=substr($dir,0,-1);
$dir=str_replace("%2F", "/", urlencode($dir));
$name=urlencode($name);
if (!$this->cacheurl["d".$dir]) {
if (!@$this->cacheurl["d".$dir]) {
// On parcours $dir en remontant les /
$end=""; $beg=$dir; $tofind=true;
while ($tofind) {

View File

@ -106,13 +106,13 @@ doone() {
REP="$ALTERNC_LOC/html/$INITIALE/$LOGIN/$sub_dir"
# Set the file readable only for the AlternC User
chown -R $GID:$GID "$REP"
chown -R alterncpanel:$GID "$REP"
chmod 2770 -R "$REP"
# Delete existings ACL
# 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- \
-Rm g:alterncpanel:rwx -m u:$GID:rw- -m 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:rwx -m g:$GID:rwx -m mask:rwx\
"$REP"
read GID LOGIN
@ -124,7 +124,7 @@ fixefile(){
/usr/bin/setfacl -bk $file
echo "gid: $GID"
echo "file: $file"
chown $GID:$GID $file
chown alterncpanel:$GID $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
echo file ownership and ACLs changed