Gdn_AuthenticationProviderModel::getProviders PHP 메소드

getProviders() 공개 메소드

public getProviders ( ) : array | null | type
리턴 array | null | type
    public function getProviders()
    {
        $this->SQL->select('uap.*')->from('UserAuthenticationProvider uap');
        if (Gdn::session()->isValid()) {
            $UserID = Gdn::session()->UserID;
            $this->SQL->select('ua.ForeignUserKey', '', 'UniqueID')->join('UserAuthentication ua', "uap.AuthenticationKey = ua.ProviderKey and ua.UserID = {$UserID}", 'left');
        }
        $Data = $this->SQL->get()->resultArray();
        $Data = Gdn_DataSet::index($Data, array('AuthenticationKey'));
        foreach ($Data as &$Row) {
            self::calculate($Row);
        }
        return $Data;
    }

Usage Example

예제 #1
0
 /**
  *
  *
  * @param string $UserReference
  * @param string $Username
  * @param $Provider
  * @throws Exception
  */
 public function disconnect($UserReference = '', $Username = '', $Provider)
 {
     if (!Gdn::request()->isAuthenticatedPostBack(true)) {
         throw new Exception('Requires POST', 405);
     }
     $this->permission('Garden.SignIn.Allow');
     $this->getUserInfo($UserReference, $Username, '', true);
     // First try and delete the authentication the fast way.
     Gdn::sql()->delete('UserAuthentication', array('UserID' => $this->User->UserID, 'ProviderKey' => $Provider));
     // Delete the profile information.
     Gdn::userModel()->saveAttribute($this->User->UserID, $Provider, null);
     if ($this->deliveryType() == DELIVERY_TYPE_ALL) {
         redirect(userUrl($this->User), '', 'connections');
     } else {
         // Grab all of the providers again.
         $PModel = new Gdn_AuthenticationProviderModel();
         $Providers = $PModel->getProviders();
         $this->setData('_Providers', $Providers);
         $this->setData('Connections', array());
         $this->fireEvent('GetConnections');
         // Send back the connection button.
         $Connection = $this->data("Connections.{$Provider}");
         require_once $this->fetchViewLocation('connection_functions');
         $this->jsonTarget("#Provider_{$Provider} .ActivateSlider", connectButton($Connection), 'ReplaceWith');
         $this->render('Blank', 'Utility', 'Dashboard');
     }
 }
All Usage Examples Of Gdn_AuthenticationProviderModel::getProviders