Exemplo n.º 1
0
 /**
  *
  * @return OW_AuthResult
  */
 public function authenticate()
 {
     $entity = $this->remoteAuthService->findByRemoteTypeAndId($this->type, $this->remoteId);
     if ($entity === null) {
         $userId = null;
         $code = OW_AuthResult::FAILURE;
     } else {
         $userId = (int) $entity->userId;
         $code = OW_AuthResult::SUCCESS;
     }
     return new OW_AuthResult($code, $userId);
 }
Exemplo n.º 2
0
 /**
  * Returns class instance
  *
  * @return BOL_RemoteAuthService
  */
 public static function getInstance()
 {
     if (!isset(self::$classInstance)) {
         self::$classInstance = new self();
     }
     return self::$classInstance;
 }
Exemplo n.º 3
0
 public function onBeforeRender()
 {
     $userId = OW::getUser()->getId();
     if ($userId === null) {
         $this->setVisible(false);
         return;
     }
     if (!OW::getConfig()->getValue('fbconnect', 'allow_synchronize')) {
         $fbFieldDto = BOL_RemoteAuthService::getInstance()->findByUserId($userId);
         if ($fbFieldDto === null) {
             $this->setVisible(false);
             return;
         }
     }
 }
Exemplo n.º 4
0
 public function onDeleteUserContent(OW_Event $event)
 {
     $params = $event->getParams();
     $userId = (int) $params['userId'];
     if ($userId > 0) {
         $moderatorId = BOL_AuthorizationService::getInstance()->getModeratorIdByUserId($userId);
         if ($moderatorId !== null) {
             BOL_AuthorizationService::getInstance()->deleteModerator($moderatorId);
         }
         BOL_AuthorizationService::getInstance()->deleteUserRolesByUserId($userId);
         if (isset($params['deleteContent']) && (bool) $params['deleteContent']) {
             BOL_CommentService::getInstance()->deleteUserComments($userId);
             BOL_RateService::getInstance()->deleteUserRates($userId);
             BOL_VoteService::getInstance()->deleteUserVotes($userId);
         }
         //delete widgets
         BOL_ComponentEntityService::getInstance()->onEntityDelete(BOL_ComponentEntityService::PLACE_DASHBOARD, $userId);
         BOL_ComponentEntityService::getInstance()->onEntityDelete(BOL_ComponentEntityService::PLACE_PROFILE, $userId);
         // delete email verify
         BOL_EmailVerifyService::getInstance()->deleteByUserId($userId);
         // delete remote auth info
         BOL_RemoteAuthService::getInstance()->deleteByUserId($userId);
         // delete user auth token
         BOL_AuthTokenDao::getInstance()->deleteByUserId($userId);
     }
 }