CODE STYLE workflow/engine/methods/roles/

FILES:
data_rolesList.php
data_rolesPermissions.php
data_rolesUsers.php
rolesUsersPermission.php
roles_AddUser.php
roles_Ajax.php
roles_List.php
This commit is contained in:
jennylee
2012-10-17 12:57:48 -04:00
parent 2ba2258eea
commit d435f51203
7 changed files with 393 additions and 452 deletions

View File

@@ -12,26 +12,25 @@
*
* 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
* 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/>.
* 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.
*
*/
require_once (PATH_RBAC . "model/RolesPeer.php");
G::LoadClass('ArrayPeer');
G::LoadClass( 'ArrayPeer' );
isset($_POST['textFilter']) ? $filter = $_POST['textFilter'] : $filter = '';
isset( $_POST['textFilter'] ) ? $filter = $_POST['textFilter'] : $filter = '';
if ($filter != ""){
$aRoles = $RBAC->getAllRolesFilter($filter);
}else{
$aRoles = $RBAC->getAllRoles();
if ($filter != "") {
$aRoles = $RBAC->getAllRolesFilter( $filter );
} else {
$aRoles = $RBAC->getAllRoles();
}
//$ocaux = $oAdditionalTables->getDataCriteria($_GET['sUID']);
@@ -43,4 +42,5 @@ if ($filter != ""){
//while($rs->next()){
// $rows[] = $rs->getRow();
//}
echo '{roles: '.G::json_encode($aRoles).'}';
echo '{roles: ' . G::json_encode( $aRoles ) . '}';

View File

@@ -12,15 +12,14 @@
*
* 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
* 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/>.
* 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.
*
*/
$ROL_UID = $_GET['rUID'];
@@ -28,18 +27,22 @@ $TYPE_DATA = $_GET["type"];
global $RBAC;
$filter = (isset($_REQUEST['textFilter']))? $_REQUEST['textFilter'] : '';
$filter = (isset( $_REQUEST['textFilter'] )) ? $_REQUEST['textFilter'] : '';
//BUG 7554: erik/ hook for existents environments that have not PM_CANCELCASE
if ($RBAC->permissionsObj->loadByCode('PM_CANCELCASE') === false) {
$RBAC->permissionsObj->create(array('PER_CODE' => 'PM_CANCELCASE', 'PER_CREATE_DATE' => date('Y-m-d H:i:s')));
if ($RBAC->permissionsObj->loadByCode( 'PM_CANCELCASE' ) === false) {
$RBAC->permissionsObj->create( array ('PER_CODE' => 'PM_CANCELCASE','PER_CREATE_DATE' => date( 'Y-m-d H:i:s' )
) );
}
if ($TYPE_DATA=='list') $oDataset = $RBAC->getRolePermissions($ROL_UID, $filter, 1);
if ($TYPE_DATA=='show') $oDataset = $RBAC->getAllPermissions($ROL_UID, $RBAC->sSystem, $filter, 1);
if ($TYPE_DATA == 'list')
$oDataset = $RBAC->getRolePermissions( $ROL_UID, $filter, 1 );
if ($TYPE_DATA == 'show')
$oDataset = $RBAC->getAllPermissions( $ROL_UID, $RBAC->sSystem, $filter, 1 );
$rows = Array();
while($oDataset->next()){
$rows[] = $oDataset->getRow();
$rows = Array ();
while ($oDataset->next()) {
$rows[] = $oDataset->getRow();
}
echo '{permissions: '.G::json_encode($rows).'}';
echo '{permissions: ' . G::json_encode( $rows ) . '}';

View File

@@ -12,15 +12,14 @@
*
* 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
* 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/>.
* 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.
*
*/
$ROL_UID = $_GET['rUID'];
@@ -28,13 +27,16 @@ $TYPE_DATA = $_GET["type"];
global $RBAC;
$filter = (isset($_REQUEST['textFilter']))? $_REQUEST['textFilter'] : '';
$filter = (isset( $_REQUEST['textFilter'] )) ? $_REQUEST['textFilter'] : '';
if ($TYPE_DATA=='list') $oDataset = $RBAC->getRoleUsers($ROL_UID, $filter);
if ($TYPE_DATA=='show') $oDataset = $RBAC->getAllUsers($ROL_UID, $filter);
if ($TYPE_DATA == 'list')
$oDataset = $RBAC->getRoleUsers( $ROL_UID, $filter );
if ($TYPE_DATA == 'show')
$oDataset = $RBAC->getAllUsers( $ROL_UID, $filter );
$rows = Array();
while($oDataset->next()){
$rows[] = $oDataset->getRow();
$rows = Array ();
while ($oDataset->next()) {
$rows[] = $oDataset->getRow();
}
echo '{users: '.G::json_encode($rows).'}';
echo '{users: ' . G::json_encode( $rows ) . '}';

View File

@@ -12,57 +12,54 @@
*
* 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
* 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/>.
* 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.
*
**/
*/
global $RBAC;
switch ($RBAC->userCanAccess('PM_USERS')) {
case - 2:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels');
G::header('location: ../login/login');
die;
break;
case - 1:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
G::header('location: ../login/login');
die;
break;
case -3:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
G::header('location: ../login/login');
die;
break;
switch ($RBAC->userCanAccess( 'PM_USERS' )) {
case - 2:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' );
G::header( 'location: ../login/login' );
die();
break;
case - 1:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::header( 'location: ../login/login' );
die();
break;
case - 3:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::header( 'location: ../login/login' );
die();
break;
}
$G_MAIN_MENU = 'processmaker';
$G_SUB_MENU = 'users';
$G_ID_MENU_SELECTED = 'USERS';
$G_ID_SUB_MENU_SELECTED = 'ROLES';
$G_PUBLISH = new Publisher;
$G_PUBLISH = new Publisher();
$oHeadPublisher =& headPublisher::getSingleton();
$oHeadPublisher = & headPublisher::getSingleton();
$oHeadPublisher->addExtJsScript('roles/rolesUsersPermission', false); //adding a javascript file .js
$oHeadPublisher->addContent('roles/rolesUsersPermission'); //adding a html file .html.
$oHeadPublisher->addExtJsScript( 'roles/rolesUsersPermission', false ); //adding a javascript file .js
$oHeadPublisher->addContent( 'roles/rolesUsersPermission' ); //adding a html file .html.
$roles = Array();
$roles = Array ();
$roles['ROL_UID'] = $_GET['rUID'];
$roles['ROL_CODE'] = $RBAC->getRoleCode($_GET['rUID']);
$roles['CURRENT_TAB'] = ($_GET['tab']=='permissions') ? 1 : 0;
$roles['ROL_CODE'] = $RBAC->getRoleCode( $_GET['rUID'] );
$roles['CURRENT_TAB'] = ($_GET['tab'] == 'permissions') ? 1 : 0;
$oHeadPublisher->assign( 'ROLES', $roles );
$oHeadPublisher->assign( 'permissionsAdmin', $RBAC->loadPermissionAdmin() );
G::RenderPage( 'publish', 'extJs' );
$oHeadPublisher->assign('ROLES', $roles);
$oHeadPublisher->assign('permissionsAdmin', $RBAC->loadPermissionAdmin());
G::RenderPage('publish', 'extJs');
?>

View File

@@ -1,35 +1,36 @@
<?php
/**
* roles_AddUser.php
*
* 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.
*
*/
require_once ( 'classes/class.xmlfield_InputPM.php' );
$G_PUBLISH = new Publisher;
require_once 'classes/model/Users.php';
$oUser = new Users();
$aData = Array('ROL_UID'=>$_GET['ROL_UID']);
$G_PUBLISH->AddContent('propeltable', 'roles/paged-table', 'roles/roles_ListUsers', $oUser->getAvailableUsersCriteria($_GET['ROL_UID']),$aData);
G::RenderPage('publish', 'raw');
die;
<?php
/**
* roles_AddUser.php
*
* 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.
*/
require_once ('classes/class.xmlfield_InputPM.php');
$G_PUBLISH = new Publisher();
require_once 'classes/model/Users.php';
$oUser = new Users();
$aData = Array ('ROL_UID' => $_GET['ROL_UID']
);
$G_PUBLISH->AddContent( 'propeltable', 'roles/paged-table', 'roles/roles_ListUsers', $oUser->getAvailableUsersCriteria( $_GET['ROL_UID'] ), $aData );
G::RenderPage( 'publish', 'raw' );
die();

File diff suppressed because it is too large Load Diff

View File

@@ -12,56 +12,51 @@
*
* 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
* 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/>.
* 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.
*
*/
global $RBAC;
switch ($RBAC->userCanAccess('PM_USERS')) {
case - 2:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels');
G::header('location: ../login/login');
die;
break;
case - 1:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
G::header('location: ../login/login');
die;
break;
case -3:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
G::header('location: ../login/login');
die;
break;
}
$G_MAIN_MENU = 'processmaker';
$G_SUB_MENU = 'users';
$G_ID_MENU_SELECTED = 'USERS';
$G_ID_SUB_MENU_SELECTED = 'ROLES';
$G_PUBLISH = new Publisher;
global $RBAC;
switch ($RBAC->userCanAccess( 'PM_USERS' )) {
case - 2:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' );
G::header( 'location: ../login/login' );
die();
break;
case - 1:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::header( 'location: ../login/login' );
die();
break;
case - 3:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::header( 'location: ../login/login' );
die();
break;
}
G::LoadClass('configuration');
$G_MAIN_MENU = 'processmaker';
$G_SUB_MENU = 'users';
$G_ID_MENU_SELECTED = 'USERS';
$G_ID_SUB_MENU_SELECTED = 'ROLES';
$G_PUBLISH = new Publisher();
G::LoadClass( 'configuration' );
$c = new Configurations();
$configPage = $c->getConfiguration('rolesList', 'pageSize','',$_SESSION['USER_LOGGED']);
$Config['pageSize'] = isset($configPage['pageSize']) ? $configPage['pageSize'] : 20;
$oHeadPublisher =& headPublisher::getSingleton();
$oHeadPublisher->addExtJsScript('roles/rolesList', false); //adding a javascript file .js
$oHeadPublisher->addContent('roles/rolesList'); //adding a html file .html.
$oHeadPublisher->assign('FORMATS',$c->getFormats());
$oHeadPublisher->assign('CONFIG', $Config);
G::RenderPage('publish', 'extJs');
?>
$configPage = $c->getConfiguration( 'rolesList', 'pageSize', '', $_SESSION['USER_LOGGED'] );
$Config['pageSize'] = isset( $configPage['pageSize'] ) ? $configPage['pageSize'] : 20;
$oHeadPublisher = & headPublisher::getSingleton();
$oHeadPublisher->addExtJsScript( 'roles/rolesList', false ); //adding a javascript file .js
$oHeadPublisher->addContent( 'roles/rolesList' ); //adding a html file .html.
$oHeadPublisher->assign( 'FORMATS', $c->getFormats() );
$oHeadPublisher->assign( 'CONFIG', $Config );
G::RenderPage( 'publish', 'extJs' );