|
|
@@ -3,6 +3,8 @@
|
|
|
Lib::loadClass('UserStorageBase');
|
|
|
Lib::loadClass('ObjectUserLdap');
|
|
|
Lib::loadClass('ObjectGroupLdap');
|
|
|
+Lib::loadClass('UsersLdapHelper');
|
|
|
+Lib::loadClass('LDAP');
|
|
|
|
|
|
/**
|
|
|
* Test remove user:
|
|
|
@@ -31,13 +33,11 @@ class UserStorageMacOSX extends UserStorageBase {
|
|
|
* @return ObjectUserLdap
|
|
|
*/
|
|
|
public function getUser($userName) {
|
|
|
- Lib::loadClass('UsersLdapHelper');
|
|
|
$usrLdap = UsersLdapHelper::getUser($userName, true);
|
|
|
if (empty($usrLdap[0])) return null;
|
|
|
|
|
|
$user = $this->_buildUserFromLdap($usrLdap[0]);
|
|
|
|
|
|
-
|
|
|
return $user;
|
|
|
}
|
|
|
|
|
|
@@ -66,7 +66,6 @@ class UserStorageMacOSX extends UserStorageBase {
|
|
|
if ($groupID <= 0) return false;
|
|
|
|
|
|
$group = null;
|
|
|
- Lib::loadClass('UsersLdapHelper');
|
|
|
$groups = UsersLdapHelper::getGroupsByID($groupID);
|
|
|
if (count($groups) == 1) {
|
|
|
$group = reset($groups);
|
|
|
@@ -81,7 +80,6 @@ class UserStorageMacOSX extends UserStorageBase {
|
|
|
}
|
|
|
|
|
|
public function getParentGroups(ObjectGroup $group) {
|
|
|
- Lib::loadClass('UsersLdapHelper');
|
|
|
$parentGroups = array();
|
|
|
$parentGroupsLdap = UsersLdapHelper::getParentGroupsByAppleUID($group->getLdapUID());
|
|
|
foreach ($parentGroupsLdap as $groupLdap) {
|
|
|
@@ -97,29 +95,10 @@ class UserStorageMacOSX extends UserStorageBase {
|
|
|
* @return bool
|
|
|
*/
|
|
|
public function isDisabled($usr) {
|
|
|
- if (null == $usr->isDisabled) {
|
|
|
- //$cmd = "sudo pwpolicy -u {$usr->login} -getpolicy";
|
|
|
- $cmd = "sudo pwpolicy -u {$usr->login} --get-effective-policy";// BUG wersja 10.9.3 opcja -getpolicy pokazuje tylko włączone opcje, nie pokaże "isDisabled=0"
|
|
|
- $cmdOut = null; $cmdRet = null;
|
|
|
- exec($cmd, $cmdOut, $cmdRet);
|
|
|
- if(V::get('DBG_SU', 0, $_GET, 'int') > 1){echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;text-align:left;">cmd('.$cmd.') ret('.$cmdRet.') (' . __CLASS__ . '::' . __FUNCTION__ . ':' . __LINE__ . '): ';print_r($cmdOut);echo'</pre>';}
|
|
|
- foreach ($cmdOut as $vLine) {
|
|
|
- if (false !== strpos($vLine, 'isDisabled=')) {
|
|
|
- if (false !== strpos($vLine, 'isDisabled=0')) {
|
|
|
- $usr->isDisabled = 0;
|
|
|
- }
|
|
|
- else if (false !== strpos($vLine, 'isDisabled=1')) {
|
|
|
- $usr->isDisabled = 1;
|
|
|
- }
|
|
|
- else if (false !== strpos($vLine, 'isDisabled=false')) {
|
|
|
- $usr->isDisabled = 0;
|
|
|
- }
|
|
|
- else if (false !== strpos($vLine, 'isDisabled=true')) {
|
|
|
- $usr->isDisabled = 1;
|
|
|
- }
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
+ if (null === $usr->isDisabled) {
|
|
|
+ $allGroups = $this->_fetchAllUserGroups($usr->login);
|
|
|
+ $usr->isDisabled = in_array('com.apple.access_disabled', $allGroups);
|
|
|
+ DBG::_('DBG_SU', '>1', "usr->isDisabled(" . (($usr->isDisabled)? 'true' : 'false') . ") ", null, __CLASS__, __FUNCTION__, __LINE__);
|
|
|
}
|
|
|
return $usr->isDisabled;
|
|
|
}
|
|
|
@@ -128,14 +107,16 @@ class UserStorageMacOSX extends UserStorageBase {
|
|
|
* @return bool
|
|
|
*/
|
|
|
public function setDisabled($usrLogin, $isDisabled) {
|
|
|
+ // pwpolicy -a diradmin -u t1 -disableuser
|
|
|
+ // pwpolicy -a diradmin -u t1 -enableuser
|
|
|
if (empty($usrLogin) || null === $isDisabled) {
|
|
|
return false;
|
|
|
}
|
|
|
- $cmdDisabled = ($isDisabled)? '1' : '0';
|
|
|
- $cmd = "pwpolicy -a {$this->_rootUser} -p {$this->_rootPass} -u {$usrLogin} -setpolicy \"isDisabled={$cmdDisabled}\" 2>&1 ";
|
|
|
+ $cmdDisabled = ($isDisabled)? ' -disableuser' : ' -enableuser';
|
|
|
+ $cmd = "pwpolicy -a {$this->_rootUser} -p {$this->_rootPass} -u {$usrLogin} {$cmdDisabled} 2>&1 ";
|
|
|
$cmdOut = null; $cmdRet = null;
|
|
|
exec($cmd, $cmdOut, $cmdRet);
|
|
|
- if(V::get('DBG_SU', 0, $_GET, 'int') > 1){echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;text-align:left;">cmd('.str_replace($this->_rootPass, '***', $cmd).') ret('.$cmdRet.') (' . __CLASS__ . '::' . __FUNCTION__ . ':' . __LINE__ . '): ';print_r($cmdOut);echo'</pre>';}
|
|
|
+ DBG::_('DBG_SU', '>1', "cmd(" . str_replace($this->_rootPass, '***', $cmd) . ") ret({$cmdRet}) ", $cmdOut, __CLASS__, __FUNCTION__, __LINE__);
|
|
|
if ($cmdRet !== 0) {
|
|
|
return false;
|
|
|
}
|
|
|
@@ -147,15 +128,11 @@ class UserStorageMacOSX extends UserStorageBase {
|
|
|
* $usr->employeeType: Pracownik, Kandydat, Partner, Anonymous
|
|
|
* Pracownik - all access
|
|
|
* Kandydat - no access
|
|
|
- * Partner - access: smb/afp? calendar? addressbook?
|
|
|
+ * Partner - access: smb/afp, TODO: calendar?, addressbook?
|
|
|
* Anonymous - no access
|
|
|
*/
|
|
|
public function createUser($usr) {
|
|
|
- //public function createUser($login, $type, $name = '', $email = '', $pass = '') {
|
|
|
-
|
|
|
- if (V::get('DBG_SU', 0, $_GET, 'int') > 1) {
|
|
|
- echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;text-align:left;">usr (' . __CLASS__ . '::' . __FUNCTION__ . ':' . __LINE__ . '): ';print_r($usr);echo'</pre>';
|
|
|
- }
|
|
|
+ DBG::_('DBG_SU', '>1', 'usr', $usr, __CLASS__, __FUNCTION__, __LINE__);
|
|
|
|
|
|
$cmdDsclAuth = "dscl -u {$this->_rootUser} -P {$this->_rootPass} /LDAPv3/127.0.0.1 ";
|
|
|
$login = $this->_cleanUid($usr->login);
|
|
|
@@ -178,8 +155,7 @@ class UserStorageMacOSX extends UserStorageBase {
|
|
|
}
|
|
|
|
|
|
if ($uniqueID <= 0) {
|
|
|
- $this->setError(1, "Error: dscl auth - check login and password in ldap config", '(' . __CLASS__ . '::' . __FUNCTION__ . ':' . __LINE__ . ')');
|
|
|
- return false;
|
|
|
+ throw new Exception("Error: dscl auth - check login and password in ldap config");
|
|
|
}
|
|
|
if (empty($name)) {
|
|
|
$name = $login;
|
|
|
@@ -206,17 +182,14 @@ class UserStorageMacOSX extends UserStorageBase {
|
|
|
$cmdOut = null; $cmdRet = null;
|
|
|
exec($cmd, $cmdOut, $cmdRet);
|
|
|
if ($cmdRet != 0) {
|
|
|
- $this->setError(1, "cmd failed: " . str_replace($cmdDsclAuth, "dscl __auth__ ", $cmd), '(' . __CLASS__ . '::' . __FUNCTION__ . ':' . __LINE__ . ')');
|
|
|
- return false;
|
|
|
+ DBG::_('DBG_SU', '>1', "cmd failed: " . str_replace($cmdDsclAuth, "dscl __auth__ ", $cmd), $cmdOut, __CLASS__, __FUNCTION__, __LINE__);
|
|
|
+ throw new Exception("Wystąpił błąd podczas tworzenia użytwkonika '{$usrLogin}' w bazie Ldap");
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- return true;
|
|
|
}
|
|
|
|
|
|
private function _getAdminLdap() {
|
|
|
if (!$this->_ldapRoot) {
|
|
|
- Lib::loadClass('LDAP');
|
|
|
$this->_ldapRoot = LDAP::getInstance();
|
|
|
if (!$this->_ldapRoot->bindDiradmin($errorMsg)) {
|
|
|
// $errorMsg?
|
|
|
@@ -307,7 +280,7 @@ class UserStorageMacOSX extends UserStorageBase {
|
|
|
}
|
|
|
break;
|
|
|
default:
|
|
|
- $this->setError(1, "TODO: update group {$group->primaryKey} field {$fldName} to value '{$val}'", '(' . __CLASS__ . '::' . __FUNCTION__ . ':' . __LINE__ . ')');
|
|
|
+ $this->setError(1, "Błąd podczas aktulizacji grupy '{$group->primaryKey}' - pole '{$fldName}' watość '{$val}'", '#L' . __LINE__);
|
|
|
}
|
|
|
}
|
|
|
return true;
|
|
|
@@ -335,7 +308,6 @@ class UserStorageMacOSX extends UserStorageBase {
|
|
|
*/
|
|
|
public function getUserGroups($usrLogin, $fetchNested = false) {
|
|
|
$groups = array();
|
|
|
- Lib::loadClass('UsersLdapHelper');
|
|
|
$groupsNetwork = $this->_getUserGroupsNetwork($usrLogin);
|
|
|
$groupsLocal = $this->_getUserGroupsLocal($usrLogin);
|
|
|
|
|
|
@@ -352,10 +324,8 @@ class UserStorageMacOSX extends UserStorageBase {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (V::get('DBG_SU', 0, $_GET, 'int') > 2) {
|
|
|
- echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;text-align:left;">groupsNetwork (' . __CLASS__ . '::' . __FUNCTION__ . ':' . __LINE__ . '): ';print_r($groupsNetwork);echo'</pre>';
|
|
|
- echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;text-align:left;">groupsLocal (' . __CLASS__ . '::' . __FUNCTION__ . ':' . __LINE__ . '): ';print_r($groupsLocal);echo'</pre>';
|
|
|
- }
|
|
|
+ DBG::_('DBG_SU', '>2', "groupsNetwork", $groupsNetwork, __CLASS__, __FUNCTION__, __LINE__);
|
|
|
+ DBG::_('DBG_SU', '>2', "groupsLocal", $groupsLocal, __CLASS__, __FUNCTION__, __LINE__);
|
|
|
return $groups;
|
|
|
}
|
|
|
|
|
|
@@ -384,7 +354,6 @@ class UserStorageMacOSX extends UserStorageBase {
|
|
|
private function _fetchNestedGroupsByAppleUids($appleUids) {
|
|
|
$groups = array();
|
|
|
if (!is_array($appleUids)) $appleUids = array($appleUids);
|
|
|
- Lib::loadClass('UsersLdapHelper');
|
|
|
$groupsLdap = UsersLdapHelper::getGroupsByAppleUids($appleUids);
|
|
|
foreach ($groupsLdap as $vGroupLdap) {
|
|
|
$group = $this->_buildGroupFromLdap($vGroupLdap, $fetchNested = false);
|
|
|
@@ -401,7 +370,6 @@ class UserStorageMacOSX extends UserStorageBase {
|
|
|
*/
|
|
|
private function _getUserGroupsNetwork($usrLogin) {
|
|
|
$groups = array();
|
|
|
- Lib::loadClass('UsersLdapHelper');
|
|
|
$groupsNetwork = UsersLdapHelper::getUserGroups($usrLogin, 0);
|
|
|
foreach ($groupsNetwork as $vGroupNetwork) {
|
|
|
$groups[$vGroupNetwork->cn] = $this->_buildGroupFromLdap($vGroupNetwork);
|
|
|
@@ -416,20 +384,32 @@ class UserStorageMacOSX extends UserStorageBase {
|
|
|
private function _getUserGroupsLocal($usrLogin) {
|
|
|
$groups = array();
|
|
|
|
|
|
+ $allGroups = $this->_fetchAllUserGroups($usrLogin);
|
|
|
+ foreach ($allGroups as $groupName) {
|
|
|
+ if ($this->_isGroupLocal($groupName)) {
|
|
|
+ $groups[$groupName] = $this->_buildGroupLocal($groupName);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ DBG::_('DBG_SU', '>1', "User '{$usrLogin}' GroupsLocal:", $groups, __CLASS__, __FUNCTION__, __LINE__);
|
|
|
+
|
|
|
+ return $groups;
|
|
|
+ }
|
|
|
+
|
|
|
+ private function _fetchAllUserGroups($usrLogin) {
|
|
|
+ $groups = array();
|
|
|
+
|
|
|
$cmd = "groups {$usrLogin}";
|
|
|
$cmdOut = null; $cmdRet = null;
|
|
|
exec($cmd, $cmdOut, $cmdRet);
|
|
|
if ($cmdRet == 0 && !empty($cmdOut[0])) {
|
|
|
$groupsCmd = explode(' ', $cmdOut[0]);
|
|
|
- foreach ($groupsCmd as $group) {
|
|
|
- if ($this->_isGroupLocal($group)) {
|
|
|
- $groups[$group] = $this->_buildGroupLocal($group);
|
|
|
+ foreach ($groupsCmd as $groupName) {
|
|
|
+ if (!empty($groupName)) {
|
|
|
+ $groups[] = $groupName;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- if (V::get('DBG_SU', 0, $_GET, 'int') > 1) {
|
|
|
- echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;text-align:left;">groups (' . __CLASS__ . '::' . __FUNCTION__ . ':' . __LINE__ . '): ';print_r($groups);echo'</pre>';
|
|
|
- }
|
|
|
+ DBG::_('DBG_SU', '>1', "User '{$usrLogin}' all groups:", $groups, __CLASS__, __FUNCTION__, __LINE__);
|
|
|
|
|
|
return $groups;
|
|
|
}
|
|
|
@@ -508,8 +488,7 @@ class UserStorageMacOSX extends UserStorageBase {
|
|
|
public function createGroup(ObjectGroup $group) {
|
|
|
// TEST: $ dscl /LDAPv3/127.0.0.1 -list /Groups PrimaryGroupID
|
|
|
if ($group->zasobID <= 0) {
|
|
|
- $this->setError(1, "Error: create group {$group->primaryKey} {$group->realName} - missing zasobID", '(' . __CLASS__ . '::' . __FUNCTION__ . ':' . __LINE__ . ')');
|
|
|
- return false;
|
|
|
+ throw new Exception("Nie udało się utworzyć grupy sieciowej '{$group->primaryKey}' '{$group->realName}' - brak numery zasobu");
|
|
|
}
|
|
|
$groupName = $this->_generateGroupName($group->zasobID, $group->realName);
|
|
|
$groupUidGenerated = $this->_generateGroupUid($group->zasobID, $group->realName);
|
|
|
@@ -530,15 +509,14 @@ class UserStorageMacOSX extends UserStorageBase {
|
|
|
$cmd = "dseditgroup -o create -n /LDAPv3/127.0.0.1 -u {$this->_rootUser} -P {$this->_rootPass} -r \"{$groupName}\" {$groupUidGenerated}";
|
|
|
$cmdOut = null; $cmdRet = null;
|
|
|
exec($cmd, $cmdOut, $cmdRet);
|
|
|
- if(V::get('DBG_SU', 0, $_GET, 'int') > 1){echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;text-align:left;">create group cmd('.str_replace($this->_rootPass, '***', $cmd).') ret('.$cmdRet.') (' . __CLASS__ . '::' . __FUNCTION__ . ':' . __LINE__ . '): ';print_r($cmdOut);echo'</pre>';}
|
|
|
+ DBG::_('DBG_SU', '>1', "create group cmd(" . str_replace($this->_rootPass, '***', $cmd) . ") ret({$cmdRet})", $cmdOut, __CLASS__, __FUNCTION__, __LINE__);
|
|
|
if ($cmdRet !== 0) {
|
|
|
- return false;
|
|
|
+ throw new Exception("Nie udało się utworzyć grupy sieciowej '{$group->primaryKey}' '{$group->realName}'");
|
|
|
}
|
|
|
//$command8 = "dscl -u {$user} -P {$pass} /LDAPv3/127.0.0.1 -append /Groups/{$groupUid} GroupMembership {$ACCOUNT} ";
|
|
|
//$command8 = "dscl -u {$user} -P {$pass} /LDAPv3/127.0.0.1 -delete /Groups/{$groupUid} GroupMembership {$ACCOUNT} ";
|
|
|
//$command1 = "dscl -u {$user} -P {$pass} /LDAPv3/127.0.0.1 -create /Groups/{$groupUid} PrimaryGroupID {$PrimaryGroupID} ";
|
|
|
//$command2 = "dscl -u {$user} -P {$pass} /LDAPv3/127.0.0.1 -create /Groups/{$groupUid} RealName \"{$groupName}\" ";
|
|
|
- return true;
|
|
|
}
|
|
|
|
|
|
private function _isGroupLocal($groupUid) {
|
|
|
@@ -585,10 +563,8 @@ class UserStorageMacOSX extends UserStorageBase {
|
|
|
$cmdOut = null; $cmdRet = null;
|
|
|
exec($cmd, $cmdOut, $cmdRet);
|
|
|
if ($cmdRet != 0) {
|
|
|
- $this->setError(1, "Error: add user '{$usrLogin}' to network group '{$groupUid}' ", '(' . __CLASS__ . '::' . __FUNCTION__ . ':' . __LINE__ . ')');
|
|
|
- return false;
|
|
|
+ throw new Exception("Nie udało się dodać usera '{$usrLogin}' do grupy lokalnej '{$groupUid}'");
|
|
|
}
|
|
|
- return true;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -611,12 +587,10 @@ class UserStorageMacOSX extends UserStorageBase {
|
|
|
|
|
|
$cmdOut = null; $cmdRet = null;
|
|
|
exec($cmd, $cmdOut, $cmdRet);
|
|
|
- if(V::get('DBG_SU', 0, $_GET, 'int') > 1){echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;text-align:left;">cmd('.$cmd.') ret('.$cmdRet.') (' . __CLASS__ . '::' . __FUNCTION__ . ':' . __LINE__ . '): ';print_r($cmdOut);echo'</pre>';}
|
|
|
+ DBG::_('DBG_SU', '>1', "cmd({$cmd}) ret({$cmdRet})", $cmdOut, __CLASS__, __FUNCTION__, __LINE__);
|
|
|
if ($cmdRet != 0) {
|
|
|
- $this->setError(1, "Error: remove user '{$usrLogin}' from local group '{$groupUid}' ", '(' . __CLASS__ . '::' . __FUNCTION__ . ':' . __LINE__ . ')');
|
|
|
- //return false;
|
|
|
+ throw new Exception("Nie udało się dodać usera '{$usrLogin}' z grupy lokalnej '{$groupUid}'");
|
|
|
}
|
|
|
- return true;
|
|
|
}
|
|
|
|
|
|
public function findGroupUidDscl($groupUid) {// not used @see findGroupUid
|
|
|
@@ -643,7 +617,6 @@ class UserStorageMacOSX extends UserStorageBase {
|
|
|
public function findGroupUidLdap($groupUid) {
|
|
|
$groupRealUid = null;
|
|
|
|
|
|
- Lib::loadClass('UsersLdapHelper');
|
|
|
$groups = UsersLdapHelper::getGroupsByID($groupUid);
|
|
|
if (count($groups) == 1) {
|
|
|
$groupRealUid = reset($groups)->cn;
|
|
|
@@ -678,19 +651,12 @@ class UserStorageMacOSX extends UserStorageBase {
|
|
|
|
|
|
if (!$groupRealUid) {
|
|
|
if ($group->type == 'network') {
|
|
|
- $this->setError(1, "Error: access denied to create network group {$group->primaryKey}", '(' . __CLASS__ . '::' . __FUNCTION__ . ':' . __LINE__ . ')');
|
|
|
- return false;
|
|
|
- }
|
|
|
- else if ($group->type == 'local') {
|
|
|
- $this->setError(1, "Error: access denied to create local group {$group->primaryKey}", '(' . __CLASS__ . '::' . __FUNCTION__ . ':' . __LINE__ . ')');
|
|
|
- return false;
|
|
|
+ throw new Exception("Brak dostępu do utworzenia grupy sieciowej '{$group->primaryKey}'");
|
|
|
+ } else if ($group->type == 'local') {
|
|
|
+ throw new Exception("Brak dostępu do utworzenia grupy lokalnej '{$group->primaryKey}'");
|
|
|
}
|
|
|
|
|
|
- $created = $this->createGroup($group);
|
|
|
- if (!$created) {
|
|
|
- $this->setError(1, "Error: create group {$group->primaryKey} {$group->realName}", '(' . __CLASS__ . '::' . __FUNCTION__ . ':' . __LINE__ . ')');
|
|
|
- return false;
|
|
|
- }
|
|
|
+ $this->createGroup($group);
|
|
|
}
|
|
|
|
|
|
$cmdDsclAuth = "dscl -u {$this->_rootUser} -P {$this->_rootPass} /LDAPv3/127.0.0.1 ";
|
|
|
@@ -698,10 +664,8 @@ class UserStorageMacOSX extends UserStorageBase {
|
|
|
$cmdOut = null; $cmdRet = null;
|
|
|
exec($cmd, $cmdOut, $cmdRet);
|
|
|
if ($cmdRet != 0) {// TODO: may return 62 - user already in this group
|
|
|
- $this->setError(1, "Error: add user '{$usrLogin}' to network group '{$groupRealUid}' ", '(' . __CLASS__ . '::' . __FUNCTION__ . ':' . __LINE__ . ')');
|
|
|
- return false;
|
|
|
+ throw new Exception("Nie udało się dodać usera '{$usrLogin}' do grupy sieciowej '{$groupUid}'");
|
|
|
}
|
|
|
- return true;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -718,11 +682,10 @@ class UserStorageMacOSX extends UserStorageBase {
|
|
|
$cmd = "{$cmdDsclAuth} -delete /Groups/{$groupUid} GroupMembership {$usrLogin} ";
|
|
|
$cmdOut = null; $cmdRet = null;
|
|
|
exec($cmd, $cmdOut, $cmdRet);
|
|
|
+ DBG::_('DBG_SU', '>1', "cmd({$cmd}) ret({$cmdRet})", $cmdOut, __CLASS__, __FUNCTION__, __LINE__);
|
|
|
if ($cmdRet != 0) {
|
|
|
- $this->setError(1, "Error: remove user '{$usrLogin}' from network group '{$groupUid}' ", '(' . __CLASS__ . '::' . __FUNCTION__ . ':' . __LINE__ . ')');
|
|
|
- //return false;// TODO: test
|
|
|
+ throw new Exception("Nie udało się dodać usera '{$usrLogin}' z grupy sieciowej '{$groupUid}'");
|
|
|
}
|
|
|
- return true;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -736,11 +699,9 @@ class UserStorageMacOSX extends UserStorageBase {
|
|
|
// $groupUid, $groupName
|
|
|
if ($group->type == 'local') {
|
|
|
return $this->_addUserGroupLocal($usrLogin, $group);
|
|
|
- }
|
|
|
- else {
|
|
|
+ } else {
|
|
|
return $this->_addUserGroupNetwork($usrLogin, $group);
|
|
|
}
|
|
|
- return false;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -753,11 +714,9 @@ class UserStorageMacOSX extends UserStorageBase {
|
|
|
public function removeUserGroup($usrLogin, $group) {
|
|
|
if ($group->type == 'local') {
|
|
|
return $this->_removeUserGroupLocal($usrLogin, $group);
|
|
|
- }
|
|
|
- else {
|
|
|
+ } else {
|
|
|
return $this->_removeUserGroupNetwork($usrLogin, $group);
|
|
|
}
|
|
|
- return false;
|
|
|
}
|
|
|
|
|
|
public function addNestedGroup($groupID, $nestedGroupID) {
|
|
|
@@ -778,8 +737,8 @@ class UserStorageMacOSX extends UserStorageBase {
|
|
|
$cmdOut = null; $cmdRet = null;
|
|
|
exec($cmd, $cmdOut, $cmdRet);
|
|
|
if ($cmdRet != 0) {
|
|
|
- if(V::get('DBG_SU', 0, $_GET, 'int') > 1){echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;text-align:left;">cmd('.str_replace($this->_rootPass, '***', $cmd).') ret('.$cmdRet.') (' . __CLASS__ . '::' . __FUNCTION__ . ':' . __LINE__ . '): ';print_r($cmdOut);echo'</pre>';}
|
|
|
- $this->setError(1, "Error: add nested group '{$groupToAdd}' to group '{$groupName}' ", '(' . __CLASS__ . '::' . __FUNCTION__ . ':' . __LINE__ . ')');
|
|
|
+ DBG::_('DBG_SU', '>1', "cmd(" . str_replace($this->_rootPass, '***', $cmd) . ") ret({$cmdRet})", $cmdOut, __CLASS__, __FUNCTION__, __LINE__);
|
|
|
+ $this->setError(1, "Nie udało się dodać grupy nadrzędnej '{$groupToAdd}' do grupy '{$groupName}' ", '(' . __CLASS__ . '::' . __FUNCTION__ . ':' . __LINE__ . ')');
|
|
|
return false;
|
|
|
}
|
|
|
return true;
|
|
|
@@ -803,8 +762,8 @@ class UserStorageMacOSX extends UserStorageBase {
|
|
|
$cmdOut = null; $cmdRet = null;
|
|
|
exec($cmd, $cmdOut, $cmdRet);
|
|
|
if ($cmdRet != 0) {
|
|
|
- if(V::get('DBG_SU', 0, $_GET, 'int') > 1){echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;text-align:left;">cmd('.str_replace($this->_rootPass, '***', $cmd).') ret('.$cmdRet.') (' . __CLASS__ . '::' . __FUNCTION__ . ':' . __LINE__ . '): ';print_r($cmdOut);echo'</pre>';}
|
|
|
- $this->setError(1, "Error: remove nested group '{$groupToRemove}' from group '{$groupName}' ", '(' . __CLASS__ . '::' . __FUNCTION__ . ':' . __LINE__ . ')');
|
|
|
+ DBG::_('DBG_SU', '>1', "cmd(" . str_replace($this->_rootPass, '***', $cmd) . ") ret({$cmdRet})", $cmdOut, __CLASS__, __FUNCTION__, __LINE__);
|
|
|
+ $this->setError(1, "Nie udało się usunąć grupy podrzędnej '{$groupToRemove}' z grupy '{$groupName}' ", '(' . __CLASS__ . '::' . __FUNCTION__ . ':' . __LINE__ . ')');
|
|
|
return false;
|
|
|
}
|
|
|
return true;
|