Changeset View
Changeset View
Standalone View
Standalone View
branches/5.2.x/core/units/users/users_item.php
Show All 29 Lines | |||||
if ( $user_groups === false || $force_reload ) { | if ( $user_groups === false || $force_reload ) { | ||||
// primary group goes first | // primary group goes first | ||||
$sql = 'SELECT GroupId | $sql = 'SELECT GroupId | ||||
FROM ' . TABLE_PREFIX . 'UserGroupRelations | FROM ' . TABLE_PREFIX . 'UserGroupRelations | ||||
WHERE (PortalUserId = ' . $this->GetID() . ') AND ( (MembershipExpires IS NULL) OR (MembershipExpires >= ' . adodb_mktime() . ') ) | WHERE (PortalUserId = ' . $this->GetID() . ') AND ( (MembershipExpires IS NULL) OR (MembershipExpires >= ' . adodb_mktime() . ') ) | ||||
ORDER BY IF(GroupId = ' . $this->GetDBField('PrimaryGroupId') . ', 1, 0) DESC'; | ORDER BY IF(GroupId = ' . $this->GetDBField('PrimaryGroupId') . ', 1, 0) DESC'; | ||||
$groups = $this->Conn->GetCol($sql); | $groups = $this->Conn->GetCol($sql); | ||||
/** @var UserHelper $user_helper */ | |||||
$user_helper = $this->Application->recallObject('UserHelper'); | $user_helper = $this->Application->recallObject('UserHelper'); | ||||
/* @var $user_helper UserHelper */ | |||||
$user_groups = Array (); | $user_groups = Array (); | ||||
$ip_restrictions = $user_helper->getGroupsWithIPRestrictions(); | $ip_restrictions = $user_helper->getGroupsWithIPRestrictions(); | ||||
foreach ($groups as $group_id) { | foreach ($groups as $group_id) { | ||||
if ( !isset($ip_restrictions[$group_id]) || kUtil::ipMatch($ip_restrictions[$group_id], "\n") ) { | if ( !isset($ip_restrictions[$group_id]) || kUtil::ipMatch($ip_restrictions[$group_id], "\n") ) { | ||||
$user_groups[] = $group_id; | $user_groups[] = $group_id; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 55 Lines • ▼ Show 20 Line(s) | |||||
* @return bool | * @return bool | ||||
* @access public | * @access public | ||||
*/ | */ | ||||
public function Create($force_id = false, $system_create = false) | public function Create($force_id = false, $system_create = false) | ||||
{ | { | ||||
$ret = parent::Create($force_id, $system_create); | $ret = parent::Create($force_id, $system_create); | ||||
if ( $ret ) { | if ( $ret ) { | ||||
// find out how to synchronize user only when it's copied to live table | // find out how to synchronize user only when it's copied to live table | ||||
/** @var UsersSyncronizeManager $sync_manager */ | |||||
$sync_manager = $this->Application->recallObject('UsersSyncronizeManager', null, Array (), Array ('InPortalSyncronize')); | $sync_manager = $this->Application->recallObject('UsersSyncronizeManager', null, Array (), Array ('InPortalSyncronize')); | ||||
/* @var $sync_manager UsersSyncronizeManager */ | |||||
$sync_manager->performAction('createUser', $this->FieldValues); | $sync_manager->performAction('createUser', $this->FieldValues); | ||||
} | } | ||||
return $ret; | return $ret; | ||||
} | } | ||||
/** | /** | ||||
* Updates previously loaded record with current item' values | * Updates previously loaded record with current item' values | ||||
* | * | ||||
* @access public | * @access public | ||||
* @param int $id Primary Key Id to update | * @param int $id Primary Key Id to update | ||||
* @param Array $update_fields | * @param Array $update_fields | ||||
* @param bool $system_update | * @param bool $system_update | ||||
* @return bool | * @return bool | ||||
* @access public | * @access public | ||||
*/ | */ | ||||
public function Update($id = null, $update_fields = null, $system_update = false) | public function Update($id = null, $update_fields = null, $system_update = false) | ||||
{ | { | ||||
$ret = parent::Update($id, $update_fields, $system_update); | $ret = parent::Update($id, $update_fields, $system_update); | ||||
if ( $ret ) { | if ( $ret ) { | ||||
// find out how to synchronize user only when it's copied to live table | // find out how to synchronize user only when it's copied to live table | ||||
/** @var UsersSyncronizeManager $sync_manager */ | |||||
$sync_manager = $this->Application->recallObject('UsersSyncronizeManager', null, Array (), Array ('InPortalSyncronize')); | $sync_manager = $this->Application->recallObject('UsersSyncronizeManager', null, Array (), Array ('InPortalSyncronize')); | ||||
/* @var $sync_manager UsersSyncronizeManager */ | |||||
$sync_manager->performAction('updateUser', $this->FieldValues); | $sync_manager->performAction('updateUser', $this->FieldValues); | ||||
} | } | ||||
return $ret; | return $ret; | ||||
} | } | ||||
/** | /** | ||||
* Deletes the record from database | * Deletes the record from database | ||||
* | * | ||||
* @param int $id | * @param int $id | ||||
* @return bool | * @return bool | ||||
* @access public | * @access public | ||||
*/ | */ | ||||
public function Delete($id = null) | public function Delete($id = null) | ||||
{ | { | ||||
$ret = parent::Delete($id); | $ret = parent::Delete($id); | ||||
if ( $ret ) { | if ( $ret ) { | ||||
/** @var UsersSyncronizeManager $sync_manager */ | |||||
$sync_manager = $this->Application->recallObject('UsersSyncronizeManager', null, Array (), Array ('InPortalSyncronize')); | $sync_manager = $this->Application->recallObject('UsersSyncronizeManager', null, Array (), Array ('InPortalSyncronize')); | ||||
/* @var $sync_manager UsersSyncronizeManager */ | |||||
$sync_manager->performAction('deleteUser', $this->FieldValues); | $sync_manager->performAction('deleteUser', $this->FieldValues); | ||||
} | } | ||||
return $ret; | return $ret; | ||||
} | } | ||||
function setName($full_name) | function setName($full_name) | ||||
▲ Show 20 Lines • Show All 53 Lines • Show Last 20 Lines |