minor change

This commit is contained in:
tomas 2005-02-23 15:54:09 +00:00
parent a609fc8f90
commit c05e76464f
2 changed files with 19 additions and 12 deletions

View File

@ -23,7 +23,7 @@
Author : $Author: tomas $
Version : $Revision: 1.10 $
Version : $Revision: 1.11 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/alib/var/alib.php,v $
------------------------------------------------------------------------------*/
@ -40,7 +40,7 @@ define('ALIBERR_NOTEXISTS', 31);
* authentication/authorization class
*
* @author $Author: tomas $
* @version $Revision: 1.10 $
* @version $Revision: 1.11 $
* @see Subjects
* @see GreenBox
*/
@ -177,11 +177,13 @@ class Alib extends Subjects{
*/
function removePerm($permid=NULL, $subj=NULL, $obj=NULL)
{
return $this->dbc->query("DELETE FROM {$this->permTable} WHERE 1=1".
($permid ? " AND permid=$permid" : '').
($subj ? " AND subj=$subj" : '').
($obj ? " AND obj=$obj" : '')
);
$ca = array();
if($permid) $ca[] = "permid=$permid";
if($subj) $ca[] = "subj=$subj";
if($obj) $ca[] = "obj=$obj";
$cond = join(" AND ", $ca);
if(!$cond) return TRUE;
return $this->dbc->query("DELETE FROM {$this->permTable} WHERE $cond");
}
/**
@ -296,6 +298,10 @@ class Alib extends Subjects{
function removeSubj($login)
{
$uid = $this->getSubjId($login); if(PEAR::isError($uid)) return $uid;
if(is_null($uid)){
return $this->dbc->raiseError("Alib::removeSubj: Subj not found ($login)",
ALIBERR_NOTEXISTS, PEAR_ERROR_RETURN);
}
$r = $this->removePerm(NULL, $uid); if(PEAR::isError($r)) return $r;
return parent::removeSubj($login, $uid);
}

View File

@ -23,7 +23,7 @@
Author : $Author: tomas $
Version : $Revision: 1.35 $
Version : $Revision: 1.36 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/var/BasicStor.php,v $
------------------------------------------------------------------------------*/
@ -52,7 +52,7 @@ require_once "Transport.php";
* Core of LiveSupport file storage module
*
* @author $Author: tomas $
* @version $Revision: 1.35 $
* @version $Revision: 1.36 $
* @see Alib
*/
class BasicStor extends Alib{
@ -859,7 +859,7 @@ class BasicStor extends Alib{
{
$uid = parent::addSubj($login, $pass);
if($this->dbc->isError($uid)) return $uid;
if(!$this->isGroup($uid)){
if($this->isGroup($uid) !== FALSE){
$fid = $this->bsCreateFolder($this->storId, $login);
if($this->dbc->isError($fid)) return $fid;
$res = $this->addPerm($uid, '_all', $fid, 'A');
@ -882,7 +882,7 @@ class BasicStor extends Alib{
return $uid;
}
/**
* Remove user and his home folder
* Remove user by login or by uid and his home folder
*
* @param login string
* @param uid int OPT
@ -890,10 +890,11 @@ class BasicStor extends Alib{
*/
function removeSubj($login, $uid=NULL)
{
$res = parent::removeSubj($login, $pass);
$res = parent::removeSubj($login);
if($this->dbc->isError($res)) return $res;
$id = $this->getObjId($login, $this->storId);
if($this->dbc->isError($id)) return $id;
// remove home folder:
$res = $this->bsDeleteFile($id);
if($this->dbc->isError($res)) return $res;
return TRUE;