/** * Checks the user's credentials. * * @param User $user The user to authenticate. * * @return boolean True in case, the user is allowed to login, false otherwise. * * @author Christian Achatz * @version * Version 0.1, 17.05.2009<br /> */ public function validateCredentials(User $user) { $authCrit = new GenericCriterionObject(); $authCrit->addPropertyIndicator('Username', $user->getUsername()); $authCrit->addPropertyIndicator('Password', md5($user->getPassword())); $gbUser = $this->orm->loadObjectByCriterion('User', $authCrit); return $gbUser !== null; }
/** * Counts the News which exist for the given application key. * * @param string $appKey Optional. Default: Current context. The application identifier, which is used to differentiate different news instances. * * @return int The number of existing news. */ public function getNewsCount($appKey = null) { if ($appKey === null) { $appKey = $this->getContext(); } $crit = new GenericCriterionObject(); $crit->addPropertyIndicator('AppKey', $appKey); return $this->ORM->loadObjectCount('News', $crit); }
/** * Loads the user by the generated ForgotPasswordHash * * @param string $hash The hash to reset the password * * @return UmgtUser|null The corresponding user or null if the user cannot be found. * * @author dave * @version * Version 0.1, 29.10.15<br /> */ public function loadUserByForgotPasswordHash($hash) { $crit = new GenericCriterionObject(); $crit->addPropertyIndicator('ForgotPasswordHash', $hash); return $this->getORMapper()->loadObjectByCriterion('User', $crit); }
/** * Loads the RecipientList with the given name, which belongs to the user. * * @param string $Name The name of the list which should be loaded * * @return RecipientList */ public function getRecipientListByName($Name) { $crit = new GenericCriterionObject(); $crit->addPropertyIndicator('Name', $Name); return $this->User->loadRelatedObject('User2RecipientList', $crit); }