コード例 #1
0
 /**
  * Funkce pro zaregistrování lokálního uživatelského účtu
  * @param array $params
  * @return User
  */
 public function registerUser($params)
 {
     $user = new User();
     $user->email = $params['email'];
     $user->password = Passwords::hash($params['password']);
     $user->name = $params['name'];
     $user->active = true;
     $user->setDbPassword(StringsHelper::randString(8));
     $user->lastLogin = new DateTime();
     $this->saveUser($user);
     return $user;
 }
コード例 #2
0
 /**
  * Funkce vracející heslo k DB na základě údajů klienta
  * @param User $user
  * @return string
  */
 private function getUserDbPassword(User $user)
 {
     return Strings::substring($user->getDbPassword(), 2, 3) . Strings::substring(sha1($user->userId . $user->getDbPassword()), 4, 5);
 }
コード例 #3
0
 /**
  * Funkce vracející připojení k databázi
  *
  * @param DbConnection $dbConnection
  * @param User $user
  * @return IDatabase
  * @throws \Exception
  */
 public function getDatabaseInstance(DbConnection $dbConnection, User $user)
 {
     $dbClass = self::getDatabaseClassName($dbConnection->type);
     return new $dbClass($dbConnection, $user->getEncodedApiKey());
 }
コード例 #4
0
 /**
  * Funkce vracející připojení k databázi
  *
  * @param PpConnection $ppConnection
  * @param User $user
  * @return IPreprocessing
  * @throws \Exception
  */
 public function getPreprocessingInstance(PpConnection $ppConnection, User $user)
 {
     $ppClass = self::getPreprocessingClassName($ppConnection->type);
     return new $ppClass($ppConnection, $user->getEncodedApiKey());
 }
コード例 #5
0
 /**
  * @param Task|null $task
  * @param MinersFacade $minersFacade
  * @param RulesFacade $rulesFacade
  * @param MetaAttributesFacade $metaAttributesFacade
  * @param User $user
  * @param XmlSerializersFactory $xmlSerializersFactory
  * @param array $params = array()
  */
 public function __construct(Task $task = null, MinersFacade $minersFacade, RulesFacade $rulesFacade, MetaAttributesFacade $metaAttributesFacade, User $user, XmlSerializersFactory $xmlSerializersFactory, $params = array())
 {
     $this->minersFacade = $minersFacade;
     $this->setTask($task);
     $this->params = $params;
     $this->rulesFacade = $rulesFacade;
     $this->metaAttributesFacade = $metaAttributesFacade;
     $this->user = $user;
     $this->xmlSerializersFactory = $xmlSerializersFactory;
     $this->setApiKey($user->getEncodedApiKey());
 }