First OAth2 Functional Implementation
This commit is contained in:
@@ -4,6 +4,7 @@ namespace ProcessMaker;
|
||||
class Api
|
||||
{
|
||||
private static $workspace;
|
||||
private static $userId;
|
||||
|
||||
public function __costruct()
|
||||
{
|
||||
@@ -19,5 +20,17 @@ class Api
|
||||
{
|
||||
return self::$workspace;
|
||||
}
|
||||
|
||||
public static function setUserId($userId)
|
||||
{
|
||||
self::$userId = $userId;
|
||||
}
|
||||
|
||||
public function getUserId()
|
||||
{
|
||||
//return self::$userId;
|
||||
|
||||
return \Api\OAuth2\Server::getUserId();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
19
workflow/engine/classes/model/PmoauthUserAccessTokens.php
Normal file
19
workflow/engine/classes/model/PmoauthUserAccessTokens.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
require_once 'classes/model/om/BasePmoauthUserAccessTokens.php';
|
||||
|
||||
|
||||
/**
|
||||
* Skeleton subclass for representing a row from the 'PMOAUTH_USER_ACCESS_TOKENS' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
* You should add additional methods to this class to meet the
|
||||
* application requirements. This class will only be generated as
|
||||
* long as it does not already exist in the output directory.
|
||||
*
|
||||
* @package classes.model
|
||||
*/
|
||||
class PmoauthUserAccessTokens extends BasePmoauthUserAccessTokens {
|
||||
|
||||
} // PmoauthUserAccessTokens
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
// include base peer class
|
||||
require_once 'classes/model/om/BasePmoauthUserAccessTokensPeer.php';
|
||||
|
||||
// include object class
|
||||
include_once 'classes/model/PmoauthUserAccessTokens.php';
|
||||
|
||||
|
||||
/**
|
||||
* Skeleton subclass for performing query and update operations on the 'PMOAUTH_USER_ACCESS_TOKENS' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
* You should add additional methods to this class to meet the
|
||||
* application requirements. This class will only be generated as
|
||||
* long as it does not already exist in the output directory.
|
||||
*
|
||||
* @package classes.model
|
||||
*/
|
||||
class PmoauthUserAccessTokensPeer extends BasePmoauthUserAccessTokensPeer {
|
||||
|
||||
} // PmoauthUserAccessTokensPeer
|
||||
@@ -69,6 +69,12 @@ class OauthClientsMapBuilder
|
||||
|
||||
$tMap->addColumn('CLIENT_SECRET', 'ClientSecret', 'string', CreoleTypes::VARCHAR, true, 80);
|
||||
|
||||
$tMap->addColumn('CLIENT_NAME', 'ClientName', 'string', CreoleTypes::VARCHAR, true, 256);
|
||||
|
||||
$tMap->addColumn('CLIENT_DESCRIPTION', 'ClientDescription', 'string', CreoleTypes::VARCHAR, true, 1024);
|
||||
|
||||
$tMap->addColumn('CLIENT_WEBSITE', 'ClientWebsite', 'string', CreoleTypes::VARCHAR, true, 1024);
|
||||
|
||||
$tMap->addColumn('REDIRECT_URI', 'RedirectUri', 'string', CreoleTypes::VARCHAR, true, 2000);
|
||||
|
||||
} // doBuild()
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
<?php
|
||||
|
||||
require_once 'propel/map/MapBuilder.php';
|
||||
include_once 'creole/CreoleTypes.php';
|
||||
|
||||
|
||||
/**
|
||||
* This class adds structure of 'PMOAUTH_USER_ACCESS_TOKENS' table to 'workflow' DatabaseMap object.
|
||||
*
|
||||
*
|
||||
*
|
||||
* These statically-built map classes are used by Propel to do runtime db structure discovery.
|
||||
* For example, the createSelectSql() method checks the type of a given column used in an
|
||||
* ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive
|
||||
* (i.e. if it's a text column type).
|
||||
*
|
||||
* @package workflow.classes.model.map
|
||||
*/
|
||||
class PmoauthUserAccessTokensMapBuilder
|
||||
{
|
||||
|
||||
/**
|
||||
* The (dot-path) name of this class
|
||||
*/
|
||||
const CLASS_NAME = 'classes.model.map.PmoauthUserAccessTokensMapBuilder';
|
||||
|
||||
/**
|
||||
* The database map.
|
||||
*/
|
||||
private $dbMap;
|
||||
|
||||
/**
|
||||
* Tells us if this DatabaseMapBuilder is built so that we
|
||||
* don't have to re-build it every time.
|
||||
*
|
||||
* @return boolean true if this DatabaseMapBuilder is built, false otherwise.
|
||||
*/
|
||||
public function isBuilt()
|
||||
{
|
||||
return ($this->dbMap !== null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the databasemap this map builder built.
|
||||
*
|
||||
* @return the databasemap
|
||||
*/
|
||||
public function getDatabaseMap()
|
||||
{
|
||||
return $this->dbMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* The doBuild() method builds the DatabaseMap
|
||||
*
|
||||
* @return void
|
||||
* @throws PropelException
|
||||
*/
|
||||
public function doBuild()
|
||||
{
|
||||
$this->dbMap = Propel::getDatabaseMap('workflow');
|
||||
|
||||
$tMap = $this->dbMap->addTable('PMOAUTH_USER_ACCESS_TOKENS');
|
||||
$tMap->setPhpName('PmoauthUserAccessTokens');
|
||||
|
||||
$tMap->setUseIdGenerator(false);
|
||||
|
||||
$tMap->addPrimaryKey('ACCESS_TOKEN', 'AccessToken', 'string', CreoleTypes::VARCHAR, true, 40);
|
||||
|
||||
$tMap->addColumn('REFRESH_TOKEN', 'RefreshToken', 'string', CreoleTypes::VARCHAR, true, 40);
|
||||
|
||||
$tMap->addColumn('USER_ID', 'UserId', 'string', CreoleTypes::VARCHAR, false, 32);
|
||||
|
||||
$tMap->addColumn('SESSION_ID', 'SessionId', 'string', CreoleTypes::VARCHAR, true, 40);
|
||||
|
||||
} // doBuild()
|
||||
|
||||
} // PmoauthUserAccessTokensMapBuilder
|
||||
@@ -39,6 +39,24 @@ abstract class BaseOauthClients extends BaseObject implements Persistent
|
||||
*/
|
||||
protected $client_secret;
|
||||
|
||||
/**
|
||||
* The value for the client_name field.
|
||||
* @var string
|
||||
*/
|
||||
protected $client_name;
|
||||
|
||||
/**
|
||||
* The value for the client_description field.
|
||||
* @var string
|
||||
*/
|
||||
protected $client_description;
|
||||
|
||||
/**
|
||||
* The value for the client_website field.
|
||||
* @var string
|
||||
*/
|
||||
protected $client_website;
|
||||
|
||||
/**
|
||||
* The value for the redirect_uri field.
|
||||
* @var string
|
||||
@@ -81,6 +99,39 @@ abstract class BaseOauthClients extends BaseObject implements Persistent
|
||||
return $this->client_secret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [client_name] column value.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getClientName()
|
||||
{
|
||||
|
||||
return $this->client_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [client_description] column value.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getClientDescription()
|
||||
{
|
||||
|
||||
return $this->client_description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [client_website] column value.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getClientWebsite()
|
||||
{
|
||||
|
||||
return $this->client_website;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [redirect_uri] column value.
|
||||
*
|
||||
@@ -136,6 +187,72 @@ abstract class BaseOauthClients extends BaseObject implements Persistent
|
||||
|
||||
} // setClientSecret()
|
||||
|
||||
/**
|
||||
* Set the value of [client_name] column.
|
||||
*
|
||||
* @param string $v new value
|
||||
* @return void
|
||||
*/
|
||||
public function setClientName($v)
|
||||
{
|
||||
|
||||
// Since the native PHP type for this column is string,
|
||||
// we will cast the input to a string (if it is not).
|
||||
if ($v !== null && !is_string($v)) {
|
||||
$v = (string) $v;
|
||||
}
|
||||
|
||||
if ($this->client_name !== $v) {
|
||||
$this->client_name = $v;
|
||||
$this->modifiedColumns[] = OauthClientsPeer::CLIENT_NAME;
|
||||
}
|
||||
|
||||
} // setClientName()
|
||||
|
||||
/**
|
||||
* Set the value of [client_description] column.
|
||||
*
|
||||
* @param string $v new value
|
||||
* @return void
|
||||
*/
|
||||
public function setClientDescription($v)
|
||||
{
|
||||
|
||||
// Since the native PHP type for this column is string,
|
||||
// we will cast the input to a string (if it is not).
|
||||
if ($v !== null && !is_string($v)) {
|
||||
$v = (string) $v;
|
||||
}
|
||||
|
||||
if ($this->client_description !== $v) {
|
||||
$this->client_description = $v;
|
||||
$this->modifiedColumns[] = OauthClientsPeer::CLIENT_DESCRIPTION;
|
||||
}
|
||||
|
||||
} // setClientDescription()
|
||||
|
||||
/**
|
||||
* Set the value of [client_website] column.
|
||||
*
|
||||
* @param string $v new value
|
||||
* @return void
|
||||
*/
|
||||
public function setClientWebsite($v)
|
||||
{
|
||||
|
||||
// Since the native PHP type for this column is string,
|
||||
// we will cast the input to a string (if it is not).
|
||||
if ($v !== null && !is_string($v)) {
|
||||
$v = (string) $v;
|
||||
}
|
||||
|
||||
if ($this->client_website !== $v) {
|
||||
$this->client_website = $v;
|
||||
$this->modifiedColumns[] = OauthClientsPeer::CLIENT_WEBSITE;
|
||||
}
|
||||
|
||||
} // setClientWebsite()
|
||||
|
||||
/**
|
||||
* Set the value of [redirect_uri] column.
|
||||
*
|
||||
@@ -179,14 +296,20 @@ abstract class BaseOauthClients extends BaseObject implements Persistent
|
||||
|
||||
$this->client_secret = $rs->getString($startcol + 1);
|
||||
|
||||
$this->redirect_uri = $rs->getString($startcol + 2);
|
||||
$this->client_name = $rs->getString($startcol + 2);
|
||||
|
||||
$this->client_description = $rs->getString($startcol + 3);
|
||||
|
||||
$this->client_website = $rs->getString($startcol + 4);
|
||||
|
||||
$this->redirect_uri = $rs->getString($startcol + 5);
|
||||
|
||||
$this->resetModified();
|
||||
|
||||
$this->setNew(false);
|
||||
|
||||
// FIXME - using NUM_COLUMNS may be clearer.
|
||||
return $startcol + 3; // 3 = OauthClientsPeer::NUM_COLUMNS - OauthClientsPeer::NUM_LAZY_LOAD_COLUMNS).
|
||||
return $startcol + 6; // 6 = OauthClientsPeer::NUM_COLUMNS - OauthClientsPeer::NUM_LAZY_LOAD_COLUMNS).
|
||||
|
||||
} catch (Exception $e) {
|
||||
throw new PropelException("Error populating OauthClients object", $e);
|
||||
@@ -397,6 +520,15 @@ abstract class BaseOauthClients extends BaseObject implements Persistent
|
||||
return $this->getClientSecret();
|
||||
break;
|
||||
case 2:
|
||||
return $this->getClientName();
|
||||
break;
|
||||
case 3:
|
||||
return $this->getClientDescription();
|
||||
break;
|
||||
case 4:
|
||||
return $this->getClientWebsite();
|
||||
break;
|
||||
case 5:
|
||||
return $this->getRedirectUri();
|
||||
break;
|
||||
default:
|
||||
@@ -421,7 +553,10 @@ abstract class BaseOauthClients extends BaseObject implements Persistent
|
||||
$result = array(
|
||||
$keys[0] => $this->getClientId(),
|
||||
$keys[1] => $this->getClientSecret(),
|
||||
$keys[2] => $this->getRedirectUri(),
|
||||
$keys[2] => $this->getClientName(),
|
||||
$keys[3] => $this->getClientDescription(),
|
||||
$keys[4] => $this->getClientWebsite(),
|
||||
$keys[5] => $this->getRedirectUri(),
|
||||
);
|
||||
return $result;
|
||||
}
|
||||
@@ -460,6 +595,15 @@ abstract class BaseOauthClients extends BaseObject implements Persistent
|
||||
$this->setClientSecret($value);
|
||||
break;
|
||||
case 2:
|
||||
$this->setClientName($value);
|
||||
break;
|
||||
case 3:
|
||||
$this->setClientDescription($value);
|
||||
break;
|
||||
case 4:
|
||||
$this->setClientWebsite($value);
|
||||
break;
|
||||
case 5:
|
||||
$this->setRedirectUri($value);
|
||||
break;
|
||||
} // switch()
|
||||
@@ -494,7 +638,19 @@ abstract class BaseOauthClients extends BaseObject implements Persistent
|
||||
}
|
||||
|
||||
if (array_key_exists($keys[2], $arr)) {
|
||||
$this->setRedirectUri($arr[$keys[2]]);
|
||||
$this->setClientName($arr[$keys[2]]);
|
||||
}
|
||||
|
||||
if (array_key_exists($keys[3], $arr)) {
|
||||
$this->setClientDescription($arr[$keys[3]]);
|
||||
}
|
||||
|
||||
if (array_key_exists($keys[4], $arr)) {
|
||||
$this->setClientWebsite($arr[$keys[4]]);
|
||||
}
|
||||
|
||||
if (array_key_exists($keys[5], $arr)) {
|
||||
$this->setRedirectUri($arr[$keys[5]]);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -516,6 +672,18 @@ abstract class BaseOauthClients extends BaseObject implements Persistent
|
||||
$criteria->add(OauthClientsPeer::CLIENT_SECRET, $this->client_secret);
|
||||
}
|
||||
|
||||
if ($this->isColumnModified(OauthClientsPeer::CLIENT_NAME)) {
|
||||
$criteria->add(OauthClientsPeer::CLIENT_NAME, $this->client_name);
|
||||
}
|
||||
|
||||
if ($this->isColumnModified(OauthClientsPeer::CLIENT_DESCRIPTION)) {
|
||||
$criteria->add(OauthClientsPeer::CLIENT_DESCRIPTION, $this->client_description);
|
||||
}
|
||||
|
||||
if ($this->isColumnModified(OauthClientsPeer::CLIENT_WEBSITE)) {
|
||||
$criteria->add(OauthClientsPeer::CLIENT_WEBSITE, $this->client_website);
|
||||
}
|
||||
|
||||
if ($this->isColumnModified(OauthClientsPeer::REDIRECT_URI)) {
|
||||
$criteria->add(OauthClientsPeer::REDIRECT_URI, $this->redirect_uri);
|
||||
}
|
||||
@@ -576,6 +744,12 @@ abstract class BaseOauthClients extends BaseObject implements Persistent
|
||||
|
||||
$copyObj->setClientSecret($this->client_secret);
|
||||
|
||||
$copyObj->setClientName($this->client_name);
|
||||
|
||||
$copyObj->setClientDescription($this->client_description);
|
||||
|
||||
$copyObj->setClientWebsite($this->client_website);
|
||||
|
||||
$copyObj->setRedirectUri($this->redirect_uri);
|
||||
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ abstract class BaseOauthClientsPeer
|
||||
const CLASS_DEFAULT = 'classes.model.OauthClients';
|
||||
|
||||
/** The total number of columns. */
|
||||
const NUM_COLUMNS = 3;
|
||||
const NUM_COLUMNS = 6;
|
||||
|
||||
/** The number of lazy-loaded columns. */
|
||||
const NUM_LAZY_LOAD_COLUMNS = 0;
|
||||
@@ -37,6 +37,15 @@ abstract class BaseOauthClientsPeer
|
||||
/** the column name for the CLIENT_SECRET field */
|
||||
const CLIENT_SECRET = 'OAUTH_CLIENTS.CLIENT_SECRET';
|
||||
|
||||
/** the column name for the CLIENT_NAME field */
|
||||
const CLIENT_NAME = 'OAUTH_CLIENTS.CLIENT_NAME';
|
||||
|
||||
/** the column name for the CLIENT_DESCRIPTION field */
|
||||
const CLIENT_DESCRIPTION = 'OAUTH_CLIENTS.CLIENT_DESCRIPTION';
|
||||
|
||||
/** the column name for the CLIENT_WEBSITE field */
|
||||
const CLIENT_WEBSITE = 'OAUTH_CLIENTS.CLIENT_WEBSITE';
|
||||
|
||||
/** the column name for the REDIRECT_URI field */
|
||||
const REDIRECT_URI = 'OAUTH_CLIENTS.REDIRECT_URI';
|
||||
|
||||
@@ -51,10 +60,10 @@ abstract class BaseOauthClientsPeer
|
||||
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
|
||||
*/
|
||||
private static $fieldNames = array (
|
||||
BasePeer::TYPE_PHPNAME => array ('ClientId', 'ClientSecret', 'RedirectUri', ),
|
||||
BasePeer::TYPE_COLNAME => array (OauthClientsPeer::CLIENT_ID, OauthClientsPeer::CLIENT_SECRET, OauthClientsPeer::REDIRECT_URI, ),
|
||||
BasePeer::TYPE_FIELDNAME => array ('CLIENT_ID', 'CLIENT_SECRET', 'REDIRECT_URI', ),
|
||||
BasePeer::TYPE_NUM => array (0, 1, 2, )
|
||||
BasePeer::TYPE_PHPNAME => array ('ClientId', 'ClientSecret', 'ClientName', 'ClientDescription', 'ClientWebsite', 'RedirectUri', ),
|
||||
BasePeer::TYPE_COLNAME => array (OauthClientsPeer::CLIENT_ID, OauthClientsPeer::CLIENT_SECRET, OauthClientsPeer::CLIENT_NAME, OauthClientsPeer::CLIENT_DESCRIPTION, OauthClientsPeer::CLIENT_WEBSITE, OauthClientsPeer::REDIRECT_URI, ),
|
||||
BasePeer::TYPE_FIELDNAME => array ('CLIENT_ID', 'CLIENT_SECRET', 'CLIENT_NAME', 'CLIENT_DESCRIPTION', 'CLIENT_WEBSITE', 'REDIRECT_URI', ),
|
||||
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, )
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -64,10 +73,10 @@ abstract class BaseOauthClientsPeer
|
||||
* e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
|
||||
*/
|
||||
private static $fieldKeys = array (
|
||||
BasePeer::TYPE_PHPNAME => array ('ClientId' => 0, 'ClientSecret' => 1, 'RedirectUri' => 2, ),
|
||||
BasePeer::TYPE_COLNAME => array (OauthClientsPeer::CLIENT_ID => 0, OauthClientsPeer::CLIENT_SECRET => 1, OauthClientsPeer::REDIRECT_URI => 2, ),
|
||||
BasePeer::TYPE_FIELDNAME => array ('CLIENT_ID' => 0, 'CLIENT_SECRET' => 1, 'REDIRECT_URI' => 2, ),
|
||||
BasePeer::TYPE_NUM => array (0, 1, 2, )
|
||||
BasePeer::TYPE_PHPNAME => array ('ClientId' => 0, 'ClientSecret' => 1, 'ClientName' => 2, 'ClientDescription' => 3, 'ClientWebsite' => 4, 'RedirectUri' => 5, ),
|
||||
BasePeer::TYPE_COLNAME => array (OauthClientsPeer::CLIENT_ID => 0, OauthClientsPeer::CLIENT_SECRET => 1, OauthClientsPeer::CLIENT_NAME => 2, OauthClientsPeer::CLIENT_DESCRIPTION => 3, OauthClientsPeer::CLIENT_WEBSITE => 4, OauthClientsPeer::REDIRECT_URI => 5, ),
|
||||
BasePeer::TYPE_FIELDNAME => array ('CLIENT_ID' => 0, 'CLIENT_SECRET' => 1, 'CLIENT_NAME' => 2, 'CLIENT_DESCRIPTION' => 3, 'CLIENT_WEBSITE' => 4, 'REDIRECT_URI' => 5, ),
|
||||
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, )
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -172,6 +181,12 @@ abstract class BaseOauthClientsPeer
|
||||
|
||||
$criteria->addSelectColumn(OauthClientsPeer::CLIENT_SECRET);
|
||||
|
||||
$criteria->addSelectColumn(OauthClientsPeer::CLIENT_NAME);
|
||||
|
||||
$criteria->addSelectColumn(OauthClientsPeer::CLIENT_DESCRIPTION);
|
||||
|
||||
$criteria->addSelectColumn(OauthClientsPeer::CLIENT_WEBSITE);
|
||||
|
||||
$criteria->addSelectColumn(OauthClientsPeer::REDIRECT_URI);
|
||||
|
||||
}
|
||||
|
||||
684
workflow/engine/classes/model/om/BasePmoauthUserAccessTokens.php
Normal file
684
workflow/engine/classes/model/om/BasePmoauthUserAccessTokens.php
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user