/**
  * 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;
 }
 /**
  * Convenience method to delete all association to another object without invoking the
  * GenericORMapper directly.
  *
  * @param string $relationName The relation to create.
  *
  * @throws GenericORMapperException In case the data component is not initialized.
  *
  * @author Christian Achatz, Ralf Schubert
  * @version
  * Version 0.1, 30.10.2010<br />
  */
 public function deleteAssociations($relationName)
 {
     // check weather data component is there
     if ($this->dataComponent === null) {
         throw new GenericORMapperException('[GenericDomainObject::deleteAssociations()] ' . 'The data component is not initialized, so related objects cannot be loaded! ' . 'Please use the or mapper\'s createAssociation() method or call ' . 'setDataComponent($orm), where $orm is an instance of the or mapper, on this ' . 'object first!', E_USER_ERROR);
     }
     // delete associations as desired
     $this->dataComponent->deleteAssociations($relationName, $this);
 }
Exemple #3
0
 /**
  * Deletes the given News.
  *
  * @param News $news
  */
 public function deleteNews(News $news)
 {
     $this->ORM->deleteObject($news);
 }
Exemple #4
0
 * In order to use this script for database initialization, include this file after including the
 * <em>bootstrap.php</em> file and setting the context and connection key.
 *
 * @example
 * <code>
 * include('./APF/core/bootstrap.php');
 * $context = 'mycontext';
 * $connectionKey = 'mysql-db';
 * include('./APF/modules/guestbook2009/data/setup/init.php');
 * </code>
 *
 * Please note, that you may have to adapt the include path for the <em>bootstrap.php</em>.
 */
use APF\modules\genericormapper\data\GenericDomainObject;
use APF\modules\genericormapper\data\GenericORRelationMapper;
$orm = new GenericORRelationMapper();
$orm->setContext($context);
$orm->addMappingConfiguration('APF\\modules\\guestbook2009\\data', 'guestbook2009');
$orm->addRelationConfiguration('APF\\modules\\guestbook2009\\data', 'guestbook2009');
$orm->setConnectionName($connectionKey);
$orm->setup();
// --- setup available languages ----------------------------------------------------------------
$langDe = new GenericDomainObject('Language');
$langDe->setProperty('ISOCode', 'de');
$langDe->setProperty('DisplayName', 'Deutsch');
$langDeId = $orm->saveObject($langDe);
$langDe->setProperty('LanguageID', $langDeId);
$langEn = new GenericDomainObject('Language');
$langEn->setProperty('ISOCode', 'en');
$langEn->setProperty('DisplayName', 'English');
$langEnId = $orm->saveObject($langEn);
Exemple #5
0
 /**
  * Checks if the current user is blocking the given user.
  *
  * @param GenericORMapperDataObject $User The user which is maybe blocked by the current user.
  *
  * @return bool
  */
 public function hasUserOnBlacklist(GenericORMapperDataObject &$User)
 {
     return $this->ORM->isAssociated('User2BlockedUser', $this->User, $User);
 }