Updates on Oauth register method and New designer open action on process list

This commit is contained in:
Erik Amaru Ortiz
2013-11-06 10:10:36 -04:00
parent e42d3a6eb5
commit a8c9748aa3
12 changed files with 118 additions and 34 deletions

View File

@@ -77,6 +77,8 @@ class OauthClientsMapBuilder
$tMap->addColumn('REDIRECT_URI', 'RedirectUri', 'string', CreoleTypes::VARCHAR, true, 2000);
$tMap->addColumn('USR_UID', 'UsrUid', 'string', CreoleTypes::VARCHAR, true, 32);
} // doBuild()
} // OauthClientsMapBuilder

View File

@@ -63,6 +63,12 @@ abstract class BaseOauthClients extends BaseObject implements Persistent
*/
protected $redirect_uri;
/**
* The value for the usr_uid field.
* @var string
*/
protected $usr_uid;
/**
* Flag to prevent endless save loop, if this object is referenced
* by another object which falls in this transaction.
@@ -143,6 +149,17 @@ abstract class BaseOauthClients extends BaseObject implements Persistent
return $this->redirect_uri;
}
/**
* Get the [usr_uid] column value.
*
* @return string
*/
public function getUsrUid()
{
return $this->usr_uid;
}
/**
* Set the value of [client_id] column.
*
@@ -275,6 +292,28 @@ abstract class BaseOauthClients extends BaseObject implements Persistent
} // setRedirectUri()
/**
* Set the value of [usr_uid] column.
*
* @param string $v new value
* @return void
*/
public function setUsrUid($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->usr_uid !== $v) {
$this->usr_uid = $v;
$this->modifiedColumns[] = OauthClientsPeer::USR_UID;
}
} // setUsrUid()
/**
* Hydrates (populates) the object variables with values from the database resultset.
*
@@ -304,12 +343,14 @@ abstract class BaseOauthClients extends BaseObject implements Persistent
$this->redirect_uri = $rs->getString($startcol + 5);
$this->usr_uid = $rs->getString($startcol + 6);
$this->resetModified();
$this->setNew(false);
// FIXME - using NUM_COLUMNS may be clearer.
return $startcol + 6; // 6 = OauthClientsPeer::NUM_COLUMNS - OauthClientsPeer::NUM_LAZY_LOAD_COLUMNS).
return $startcol + 7; // 7 = OauthClientsPeer::NUM_COLUMNS - OauthClientsPeer::NUM_LAZY_LOAD_COLUMNS).
} catch (Exception $e) {
throw new PropelException("Error populating OauthClients object", $e);
@@ -531,6 +572,9 @@ abstract class BaseOauthClients extends BaseObject implements Persistent
case 5:
return $this->getRedirectUri();
break;
case 6:
return $this->getUsrUid();
break;
default:
return null;
break;
@@ -557,6 +601,7 @@ abstract class BaseOauthClients extends BaseObject implements Persistent
$keys[3] => $this->getClientDescription(),
$keys[4] => $this->getClientWebsite(),
$keys[5] => $this->getRedirectUri(),
$keys[6] => $this->getUsrUid(),
);
return $result;
}
@@ -606,6 +651,9 @@ abstract class BaseOauthClients extends BaseObject implements Persistent
case 5:
$this->setRedirectUri($value);
break;
case 6:
$this->setUsrUid($value);
break;
} // switch()
}
@@ -653,6 +701,10 @@ abstract class BaseOauthClients extends BaseObject implements Persistent
$this->setRedirectUri($arr[$keys[5]]);
}
if (array_key_exists($keys[6], $arr)) {
$this->setUsrUid($arr[$keys[6]]);
}
}
/**
@@ -688,6 +740,10 @@ abstract class BaseOauthClients extends BaseObject implements Persistent
$criteria->add(OauthClientsPeer::REDIRECT_URI, $this->redirect_uri);
}
if ($this->isColumnModified(OauthClientsPeer::USR_UID)) {
$criteria->add(OauthClientsPeer::USR_UID, $this->usr_uid);
}
return $criteria;
}
@@ -752,6 +808,8 @@ abstract class BaseOauthClients extends BaseObject implements Persistent
$copyObj->setRedirectUri($this->redirect_uri);
$copyObj->setUsrUid($this->usr_uid);
$copyObj->setNew(true);

View File

@@ -25,7 +25,7 @@ abstract class BaseOauthClientsPeer
const CLASS_DEFAULT = 'classes.model.OauthClients';
/** The total number of columns. */
const NUM_COLUMNS = 6;
const NUM_COLUMNS = 7;
/** The number of lazy-loaded columns. */
const NUM_LAZY_LOAD_COLUMNS = 0;
@@ -49,6 +49,9 @@ abstract class BaseOauthClientsPeer
/** the column name for the REDIRECT_URI field */
const REDIRECT_URI = 'OAUTH_CLIENTS.REDIRECT_URI';
/** the column name for the USR_UID field */
const USR_UID = 'OAUTH_CLIENTS.USR_UID';
/** The PHP to DB Name Mapping */
private static $phpNameMap = null;
@@ -60,10 +63,10 @@ abstract class BaseOauthClientsPeer
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/
private static $fieldNames = array (
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, )
BasePeer::TYPE_PHPNAME => array ('ClientId', 'ClientSecret', 'ClientName', 'ClientDescription', 'ClientWebsite', 'RedirectUri', 'UsrUid', ),
BasePeer::TYPE_COLNAME => array (OauthClientsPeer::CLIENT_ID, OauthClientsPeer::CLIENT_SECRET, OauthClientsPeer::CLIENT_NAME, OauthClientsPeer::CLIENT_DESCRIPTION, OauthClientsPeer::CLIENT_WEBSITE, OauthClientsPeer::REDIRECT_URI, OauthClientsPeer::USR_UID, ),
BasePeer::TYPE_FIELDNAME => array ('CLIENT_ID', 'CLIENT_SECRET', 'CLIENT_NAME', 'CLIENT_DESCRIPTION', 'CLIENT_WEBSITE', 'REDIRECT_URI', 'USR_UID', ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, )
);
/**
@@ -73,10 +76,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, '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, )
BasePeer::TYPE_PHPNAME => array ('ClientId' => 0, 'ClientSecret' => 1, 'ClientName' => 2, 'ClientDescription' => 3, 'ClientWebsite' => 4, 'RedirectUri' => 5, 'UsrUid' => 6, ),
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, OauthClientsPeer::USR_UID => 6, ),
BasePeer::TYPE_FIELDNAME => array ('CLIENT_ID' => 0, 'CLIENT_SECRET' => 1, 'CLIENT_NAME' => 2, 'CLIENT_DESCRIPTION' => 3, 'CLIENT_WEBSITE' => 4, 'REDIRECT_URI' => 5, 'USR_UID' => 6, ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, )
);
/**
@@ -189,6 +192,8 @@ abstract class BaseOauthClientsPeer
$criteria->addSelectColumn(OauthClientsPeer::REDIRECT_URI);
$criteria->addSelectColumn(OauthClientsPeer::USR_UID);
}
const COUNT = 'COUNT(OAUTH_CLIENTS.CLIENT_ID)';

View File

@@ -3032,6 +3032,7 @@
<column name="CLIENT_DESCRIPTION" type="VARCHAR" size="1024" required="true" />
<column name="CLIENT_WEBSITE" type="VARCHAR" size="1024" required="true" />
<column name="REDIRECT_URI" type="VARCHAR" size="2000" required="true" />
<column name="USR_UID" type="VARCHAR" size="32" required="true" />
</table>
<table name="OAUTH_REFRESH_TOKENS">
<column name="REFRESH_TOKEN" type="VARCHAR" size="40" required="true" primaryKey="true" />

View File

@@ -0,0 +1,32 @@
<?php
/**
* Designer Controller
*
* @inherits Controller
* @access public
*/
class Designer extends Controller
{
public function __construct ()
{
}
/**
* Index Action
*
* @param string $httpData (opional)
*/
public function index($httpData)
{
$proUid = isset($httpData->pro_uid) ? $httpData->pro_uid : '';
$this->setVar('pro_uid', $proUid);
$this->setView('designer/index');
$this->render();
}
}

View File

@@ -1520,6 +1520,7 @@ CREATE TABLE `OAUTH_CLIENTS`
`CLIENT_DESCRIPTION` VARCHAR(1024) NOT NULL,
`CLIENT_WEBSITE` VARCHAR(1024) NOT NULL,
`REDIRECT_URI` VARCHAR(2000) NOT NULL,
`USR_UID` VARCHAR(32) NOT NULL,
PRIMARY KEY (`CLIENT_ID`)
)ENGINE=InnoDB ;
#-----------------------------------------------------------------------------

View File

@@ -51,8 +51,6 @@ if ($RBAC->userCanAccess('PM_SETUP') == 1 || $RBAC->userCanAccess('PM_USERS') ==
$G_TMP_MENU->AddIdRawOption('SETUP', 'setup/main', G::LoadTranslation('ID_SETUP'), '', '', '', 'x-pm-setup');
}
$G_TMP_MENU->AddIdRawOption('DESIGNER', 'designer/main', 'Designer 2', '', '', '', 'x-pm-setup');
// PLUGINS MENUS
if( file_exists(PATH_CORE . 'menus/plugin.php') ) {
require_once(PATH_CORE . 'menus/plugin.php');

View File

@@ -1,9 +0,0 @@
<?php
$G_MAIN_MENU = 'processmaker';
$G_ID_MENU_SELECTED = 'DESIGNER';
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent( 'view', 'designer/main' );
G::RenderPage('publish', 'minimal');

View File

@@ -18,8 +18,6 @@ switch ($_SERVER['REQUEST_METHOD']) {
\Api\OAuth2\Server::setPmClientId('x-pm-local-client');
$oauthServer = new \Api\OAuth2\Server();
$oauthServer->setConfig('enforce_state', false);
$userid = $_SESSION['USER_LOGGED'];
$authorize = isset($_POST['authorize']) ? (bool) $_POST['authorize'] : false;

View File

@@ -20,6 +20,7 @@ switch ($_SERVER['REQUEST_METHOD']) {
$client->setClientDescription($data['description']);
$client->setClientWebsite($data['web_site']);
$client->setRedirectUri($data['callback_url']);
$client->setUsrUid($_SESSION['USER_LOGGED']);
$client->save();

View File

@@ -1,6 +1,3 @@
<?php
$sessionId = session_id();
?>
<h1>We can put all html code for new Designer!</h1>
<h2>On a clean environment!!</h2>
<h3>Session Id: <?php echo $sessionId?></h3>
<h3>Process Id: {$pro_uid}</h3>

View File

@@ -226,12 +226,12 @@ Ext.onReady(function(){
iconCls: 'button_menu_ext ss_sprite ss_pencil',
//icon: '/images/edit.gif',
handler: editProcess
},/*{
text:TRANSLATIONS.ID_EDIT_BPMN,
},{
text: 'Edit (New Editor)',
iconCls: 'button_menu_ext',
icon: '/images/pencil_beta.png',
handler: editNewProcess
},*/{
},{
text: _('ID_STATUS'),
id:'activator',
icon: '',
@@ -374,11 +374,11 @@ Ext.onReady(function(){
text: _('ID_EDIT'),
iconCls: 'button_menu_ext ss_sprite ss_pencil',
handler: editProcess
},/*{
text: _('ID_EDIT_BPMN'),
},{
text: 'Edit (New Editor)',
icon: '/images/pencil_beta.png',
handler: editNewProcess
},*/ {
}, {
id: 'activator2',
text: '',
icon: '',
@@ -543,7 +543,7 @@ editProcess = function(){
editNewProcess = function(){
var rowSelected = processesGrid.getSelectionModel().getSelected();
if( rowSelected ) {
location.href = '../bpmnDesigner?id='+rowSelected.data.PRO_UID
location.href = '../designer?pro_uid='+rowSelected.data.PRO_UID
} else {
Ext.Msg.show({
title:'',