Oauth2 Registering and Access Management is complete now.

- User can register applications and manage them
- User can manage access tokens from interface on profile menu
This commit is contained in:
Erik Amaru Ortiz
2014-06-10 13:03:47 -04:00
parent 92c695772d
commit 7333cf1444
7 changed files with 83 additions and 22 deletions

View File

@@ -117,6 +117,7 @@ class OauthAccessTokens extends BaseOauthAccessTokens
$criteria->addSelectColumn(OauthClientsPeer::CLIENT_DESCRIPTION);
$criteria->addJoin(OauthAccessTokensPeer::CLIENT_ID, OauthClientsPeer::CLIENT_ID, Criteria::LEFT_JOIN);
$criteria->add(OauthAccessTokensPeer::EXPIRES, date('Y-m-d H:i:s'), Criteria::GREATER_THAN);
if ($arrayFilterData && isset($arrayFilterData["USER_ID"]) && $arrayFilterData["USER_ID"] != "") {
$criteria->add(OauthAccessTokensPeer::USER_ID, $arrayFilterData["USER_ID"], Criteria::EQUAL);

View File

@@ -151,6 +151,8 @@ class OauthClients extends BaseOauthClients
$criteria->addSelectColumn(OauthClientsPeer::REDIRECT_URI);
$criteria->addSelectColumn(OauthClientsPeer::USR_UID);
$criteria->add(OauthClientsPeer::CLIENT_ID, 'x-pm-local-client', Criteria::NOT_EQUAL);
if ($arrayFilterData && isset($arrayFilterData["USR_UID"]) && $arrayFilterData["USR_UID"] != "") {
$criteria->add(OauthClientsPeer::USR_UID, $arrayFilterData["USR_UID"], Criteria::EQUAL);
}

View File

@@ -0,0 +1,28 @@
<?php
/**
* main.php Cases List main processor
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent('view', 'oauth2/applicationsLoad');
G::RenderPage('publish');

View File

@@ -3,7 +3,7 @@ $config = array();
$config["pageSize"] = 20;
$headPublisher = &headPublisher::getSingleton();
$headPublisher->addContent("oauth2" . PATH_SEP . "clientSetup"); //Adding a HTML file .html
//$headPublisher->addContent("oauth2" . PATH_SEP . "clientSetup"); //Adding a HTML file .html
$headPublisher->addExtJsScript("oauth2" . PATH_SEP . "clientSetup", false); //Adding a JavaScript file .js
$headPublisher->assign("CONFIG", $config);
$headPublisher->assign("CREATE_CLIENT", (isset($_GET["create_app"]))? 1 : 0);

View File

@@ -332,7 +332,7 @@ accessTokenSetup.application = {
});
var btn2 = new Ext.Button({
text: "Delete",
text: "Remove Access",
iconCls: "button_menu_ext ss_sprite ss_cross",
renderTo: id2,
@@ -342,11 +342,11 @@ accessTokenSetup.application = {
sm.selectRow(rowIndex, true);
var record = grdpnlMain.getSelectionModel().getSelected();
console.log(record);
if (typeof(record) != "undefined") {
Ext.MessageBox.confirm(
_("ID_CONFIRM"),
"Do you want to delete selected Application?",
"Are you sure to remove access to the <b>"+record.get("CLIENT_NAME")+"</b> application?",
function (btn)
{
if (btn == "yes") {
@@ -394,13 +394,13 @@ accessTokenSetup.application = {
//style: "margin: 0 auto 0 auto;",
//width: 550,
//height: 450,
title: "<div><div style=\"float: left;\">" + "Applications" + "</div><div id=\"divClientSetup\" style=\"float: right;\"></div><div style=\"clear: both; height: 0; line-height:0; font-size: 0;\"></div></div>",
title: "<div><div style=\"float: left;\">" + "User Applications" + "</div><div id=\"divClientSetup\" style=\"float: right;\"></div><div style=\"clear: both; height: 0; line-height:0; font-size: 0;\"></div></div>",
border: false,
listeners: {
afterrender: function (grid)
{
var btn = new Ext.Button({
/*ar btn = new Ext.Button({
text: "&nbsp;" + "Setup My Applications",
iconCls: "button_menu_ext ss_sprite ss_cog",
renderTo: "divClientSetup",
@@ -409,7 +409,7 @@ accessTokenSetup.application = {
{
location.href = "clientSetup";
}
});
});*/
}
}
});

View File

@@ -0,0 +1,30 @@
<body onresize="autoResizeScreen()" onload="autoResizeScreen()">
<style type="text/css">
*html body {
overflow-y: hidden;
}
</style>
<iframe name="adminFrame" id="adminFrame" src ="clientSetup" width="99%" height="768" frameborder="0">
<p>Your browser does not support iframes.</p>
</iframe>
</body>
<script>
oClientWinSize = getClientWindowSize();
if ( document.getElementById('pm_submenu') )
document.getElementById('pm_submenu').style.display = 'none';
document.documentElement.style.overflowY = 'hidden';
function autoResizeScreen() {
oCasesFrame = document.getElementById('adminFrame');
oClientWinSize = getClientWindowSize();
height = oClientWinSize.height-90;
oCasesFrame.style.height = height;
oCasesSubFrame = oCasesFrame.contentWindow.document.getElementById('setup-frame');
if(oCasesSubFrame)
oCasesSubFrame.style.height = height-5;
else
setTimeout('autoResizeScreen()', 2000);
}
</script>
</html>

View File

@@ -137,7 +137,7 @@ clientSetup.application = {
winData.setTitle("Edit Application");
winData.show();
Ext.getCmp("btnSubmit").btnEl.dom.innerHTML = "Edit Application";
Ext.getCmp("btnSubmit").btnEl.dom.innerHTML = "Save Changes";
Ext.getCmp("txtName").allowBlank = false;
}
@@ -336,8 +336,8 @@ clientSetup.application = {
id: "txtRedirectUri",
name: "txtRedirectUri",
fieldLabel: "Callback URL",
vtype: "url"
fieldLabel: "Callback URL"/*,
vtype: "url"*/
},
{
xtype: "label",
@@ -353,7 +353,7 @@ clientSetup.application = {
buttons: [
{
id: "btnSubmit",
//text: "",
text: "Save",
handler: function ()
{
if (Ext.getCmp("frmOauthClient").getForm().isValid()) {
@@ -634,22 +634,22 @@ clientSetup.application = {
//style: "margin: 0 auto 0 auto;",
//width: 550,
//height: 450,
title: "<div><div style=\"float: left;\">" + "My Applications" + "</div><div id=\"divAccessTokenSetup\" style=\"float: right;\"></div><div style=\"clear: both; height: 0; line-height:0; font-size: 0;\"></div></div>",
title: "<div><div style=\"float: left;\">" + "ProcessMaker Dev Tools / User Applications" + "</div><div id=\"divAccessTokenSetup\" style=\"float: right;\"></div><div style=\"clear: both; height: 0; line-height:0; font-size: 0;\"></div></div>",
border: false,
listeners: {
afterrender: function (grid)
{
var btn = new Ext.Button({
text: "&nbsp;" + "Applications",
iconCls: "button_menu_ext ss_sprite ss_arrow_left",
renderTo: "divAccessTokenSetup",
handler: function ()
{
location.href = "accessTokenSetup";
}
});
// var btn = new Ext.Button({
// text: "&nbsp;" + "Applications",
// iconCls: "button_menu_ext ss_sprite ss_arrow_left",
// renderTo: "divAccessTokenSetup",
//
// handler: function ()
// {
// location.href = "accessTokenSetup";
// }
// });
},
rowdblclick: function (grid, rowIndex, evt)
{