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]));
 }
 public function __construct($username, $isAdmin = false)
 {
     parent::__construct($username);
     $this->isAdmin = $isAdmin;
     $this->accessToken = 'access';
     $this->refreshToken = 'refresh';
 }
Beispiel #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}();
     }
 }
Beispiel #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);
 }
 /**
  * @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 = [];
 }
Beispiel #7
0
 public function equals(UserInterface $user)
 {
     return parent::equals($user);
     // TODO: Change the autogenerated stub
 }
Beispiel #8
0
 /**
  * @param string $username
  */
 public function __construct($username, $email)
 {
     parent::__construct($username);
     $this->email = $email;
 }
 /**
  * {@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;
 }
Beispiel #10
0
 public function __construct($username, $isAdmin = false)
 {
     parent::__construct($username);
     $this->isAdmin = $isAdmin;
 }
Beispiel #11
0
 public function __construct($username, User $user, $isAdmin)
 {
     $this->user = $user;
     $this->isAdmin = $isAdmin;
     parent::__construct($username);
 }
Beispiel #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';
 }