getOneUser($login); if (is_null($user)) { throw new core_kernel_users_Exception(sprintf('Requested user with login %s not found.', $login)); } return $user; } /** * @param $login * @return \core_kernel_classes_Container * @throws \core_kernel_persistence_Exception * @throws core_kernel_users_Exception */ public function getStatus($login) { return $this->getUser($login)->getOnePropertyValue($this->getProperty(self::PROPERTY_USER_ACCOUNT_STATUS)); } /** * @param $login * @param $by * @throws core_kernel_users_Exception */ public function setLockedStatus($login, $by) { $this->getUser($login)->editPropertyValues($this->getProperty(self::PROPERTY_USER_ACCOUNT_STATUS), self::PROPERTY_USER_STATUS_LOCKED); $this->getUser($login)->editPropertyValues($this->getProperty(self::PROPERTY_USER_LOCKED_BY), $by); } /** * @param $login * @throws core_kernel_users_Exception */ public function setUnlockedStatus($login) { $this->getUser($login)->removePropertyValues($this->getProperty(self::PROPERTY_USER_ACCOUNT_STATUS)); $this->getUser($login)->editPropertyValues($this->getProperty(self::PROPERTY_USER_LOCKED_BY), null); } /** * @param string $login * @return int * @throws \core_kernel_persistence_Exception * @throws core_kernel_users_Exception */ public function getFailures($login) { return (intval((string)$this->getUser($login)->getOnePropertyValue($this->getProperty(self::PROPERTY_USER_LOGON_FAILURES)))); } /** * @param string $login * @param $value * @return bool * @throws core_kernel_users_Exception */ public function setFailures($login, $value) { $user = $this->getUser($login); $user->editPropertyValues($this->getProperty(self::PROPERTY_USER_LOGON_FAILURES), $value); if ($value) { $user->editPropertyValues($this->getProperty(self::PROPERTY_USER_LAST_LOGON_FAILURE_TIME), time()); } return true; } /** * @param string $login * @return mixed * @throws \core_kernel_persistence_Exception * @throws core_kernel_users_Exception */ public function getLastFailureTime($login) { return $this->getUser($login)->getOnePropertyValue($this->getProperty(self::PROPERTY_USER_LAST_LOGON_FAILURE_TIME)); } /** * @param $login * @return \core_kernel_classes_Container * @throws \core_kernel_persistence_Exception * @throws core_kernel_users_Exception */ public function getLockedBy($login) { return $this->getUser($login)->getOnePropertyValue($this->getProperty(self::PROPERTY_USER_LOCKED_BY)); } }