Rename all models

This commit is contained in:
Frederic Guillot
2016-05-28 19:48:22 -04:00
parent 936376ffe7
commit 14713b0ec7
411 changed files with 4145 additions and 4156 deletions

View File

@@ -21,7 +21,7 @@ class GroupSync extends Base
*/
public function synchronize($userId, array $externalGroupIds)
{
$userGroups = $this->groupMember->getGroups($userId);
$userGroups = $this->groupMemberModel->getGroups($userId);
$this->addGroups($userId, $userGroups, $externalGroupIds);
$this->removeGroups($userId, $userGroups, $externalGroupIds);
}
@@ -40,10 +40,10 @@ class GroupSync extends Base
foreach ($externalGroupIds as $externalGroupId) {
if (! isset($userGroupIds[$externalGroupId])) {
$group = $this->group->getByExternalId($externalGroupId);
$group = $this->groupModel->getByExternalId($externalGroupId);
if (! empty($group)) {
$this->groupMember->addUser($group['id'], $userId);
$this->groupMemberModel->addUser($group['id'], $userId);
}
}
}
@@ -61,7 +61,7 @@ class GroupSync extends Base
{
foreach ($userGroups as $userGroup) {
if (! empty($userGroup['external_id']) && ! in_array($userGroup['external_id'], $externalGroupIds)) {
$this->groupMember->removeUser($userGroup['id'], $userId);
$this->groupMemberModel->removeUser($userGroup['id'], $userId);
}
}
}

View File

@@ -25,12 +25,12 @@ class UserProfile extends Base
*/
public function assign($userId, UserProviderInterface $user)
{
$profile = $this->user->getById($userId);
$profile = $this->userModel->getById($userId);
$values = UserProperty::filterProperties($profile, UserProperty::getProperties($user));
$values['id'] = $userId;
if ($this->user->update($values)) {
if ($this->userModel->update($values)) {
$profile = array_merge($profile, $values);
$this->userSession->initialize($profile);
return true;
@@ -49,7 +49,7 @@ class UserProfile extends Base
public function initialize(UserProviderInterface $user)
{
if ($user->getInternalId()) {
$profile = $this->user->getById($user->getInternalId());
$profile = $this->userModel->getById($user->getInternalId());
} elseif ($user->getExternalIdColumn() && $user->getExternalId()) {
$profile = $this->userSync->synchronize($user);
$this->groupSync->synchronize($profile['id'], $user->getExternalGroupIds());

View File

@@ -22,7 +22,7 @@ class UserSession extends Base
public function refresh($user_id)
{
if ($this->getId() == $user_id) {
$this->initialize($this->user->getById($user_id));
$this->initialize($this->userModel->getById($user_id));
}
}

View File

@@ -21,7 +21,7 @@ class UserSync extends Base
*/
public function synchronize(UserProviderInterface $user)
{
$profile = $this->user->getByExternalId($user->getExternalIdColumn(), $user->getExternalId());
$profile = $this->userModel->getByExternalId($user->getExternalIdColumn(), $user->getExternalId());
$properties = UserProperty::getProperties($user);
if (! empty($profile)) {
@@ -47,7 +47,7 @@ class UserSync extends Base
if (! empty($values)) {
$values['id'] = $profile['id'];
$result = $this->user->update($values);
$result = $this->userModel->update($values);
return $result ? array_merge($profile, $properties) : $profile;
}
@@ -64,13 +64,13 @@ class UserSync extends Base
*/
private function createUser(UserProviderInterface $user, array $properties)
{
$userId = $this->user->create($properties);
$userId = $this->userModel->create($properties);
if ($userId === false) {
$this->logger->error('Unable to create user profile: '.$user->getExternalId());
return array();
}
return $this->user->getById($userId);
return $this->userModel->getById($userId);
}
}