public function testEquals()
 {
     $otherUser = new OAuthUser('other');
     $sameUser = new OAuthUser('asm89');
     $this->assertFalse($this->user->equals($otherUser));
     $this->assertTrue($this->user->equals($sameUser));
 }
 public function testOAuth()
 {
     $accessToken = array('access_token' => '986d3212c8aca7122993035d82742270f168db5e');
     $token = new OAuthToken($accessToken, array('ROLE_ADMIN'));
     $this->assertEquals('986d3212c8aca7122993035d82742270f168db5e', $token->getAccessToken());
     $user = new OAuthUser('anna_admin');
     $this->assertEquals('anna_admin', $user->getUsername());
     $token->setUser($user);
     $this->assertSame('ROLE_ADMIN', current($token->getRoles()[0]));
 }
Exemplo n.º 3
0
 public function __construct($username, $isAdmin = false)
 {
     parent::__construct($username);
     $this->isAdmin = $isAdmin;
     $this->accessToken = 'access';
     $this->refreshToken = 'refresh';
 }
Exemplo n.º 4
0
 public function __construct(UserResponseInterface $response)
 {
     parent::__construct($response->getUsername());
     $this->data = array('provider' => $response->getResourceOwner()->getName(), 'providerId' => $response->getUsername());
     $vars = array('nickname', 'realname', 'email', 'profilePicture', 'accessToken', 'refreshToken', 'tokenSecret', 'expiresIn');
     foreach ($vars as $v) {
         $fct = 'get' . ucfirst($v);
         $this->data[$v] = $response->{$fct}();
     }
 }
Exemplo n.º 5
0
 public function __construct($id, User $user, $isAdmin)
 {
     $this->user = $user;
     $this->isAdmin = $isAdmin;
     //        \Symfony\Component\VarDumper\VarDumper::dump($username);
     //        \Symfony\Component\VarDumper\VarDumper::dump($user);
     //        \Symfony\Component\VarDumper\VarDumper::dump($isAdmin);
     //        die();
     parent::__construct($id);
 }
Exemplo n.º 6
0
 /**
  * @param string $username
  * @param string $password
  * @param string $firstName
  * @param string $lastName
  * @param string $locale
  * @param string $accessToken
  * @param string $refreshToken
  */
 public function __construct($username, $password, $firstName, $lastName, $locale, $accessToken, $refreshToken)
 {
     parent::__construct($username);
     $this->password = $password;
     $this->firstName = $firstName;
     $this->lastName = $lastName;
     $this->locale = $locale;
     $this->accessToken = $accessToken;
     $this->refreshToken = $refreshToken;
     $this->roles = [];
     $this->applications = [];
 }
Exemplo n.º 7
0
 public function equals(UserInterface $user)
 {
     return parent::equals($user);
     // TODO: Change the autogenerated stub
 }
Exemplo n.º 8
0
 /**
  * @param string $username
  */
 public function __construct($username, $email)
 {
     parent::__construct($username);
     $this->email = $email;
 }
Exemplo n.º 9
0
 /**
  * {@inheritdoc}
  */
 public function getRoles()
 {
     $roles = parent::getRoles();
     if ($this->systemAdministrator === true) {
         $roles[] = 'ROLE_SUPER_ADMIN';
     }
     foreach ($this->getUserGroupUsers() as $userGroupUsers) {
         if ($userGroupUsers->getUserGroup()->getCanManageSite() === true) {
             $roles[] = 'ROLE_SITE_MANAGER';
             break;
         }
     }
     return $roles;
 }
Exemplo n.º 10
0
 public function __construct($username, $isAdmin = false)
 {
     parent::__construct($username);
     $this->isAdmin = $isAdmin;
 }
Exemplo n.º 11
0
 public function __construct($username, User $user, $isAdmin)
 {
     $this->user = $user;
     $this->isAdmin = $isAdmin;
     parent::__construct($username);
 }
Exemplo n.º 12
0
 /**
  * Constructor
  */
 public function __construct()
 {
     parent::__construct(null);
     $this->roles = new ArrayCollection();
     $this->name = null;
     $this->deleted = false;
     $this->advertisments = new ArrayCollection();
     $this->rating = 0;
     $this->votesCount = 0;
     $this->votes = [];
     $this->orders = [];
     $this->payments = [];
     if ($this->avatar === null) {
         $this->avatar = '/css/img/icon-user-default.png';
     }
     $this->salt = User::generateToken();
     $this->language = 'ua';
 }