BUG 6697 SOLVED.
Improve User List
This commit is contained in:
@@ -858,6 +858,20 @@ class RBAC
|
||||
return $this->authSourcesObj->getAllAuthSources();
|
||||
}
|
||||
|
||||
/**
|
||||
* this function gets all authentication source
|
||||
* Authentication Sources By User
|
||||
*
|
||||
* @access public
|
||||
* @author Enrique Ponce de Leon <enrique@colosa.com>
|
||||
* @param void
|
||||
* @return $this->authSourcesObj->getAllAuthSources()
|
||||
*/
|
||||
|
||||
function getAllAuthSourcesByUser() {
|
||||
return $this->authSourcesObj->getAllAuthSourcesByUser();
|
||||
}
|
||||
|
||||
/**
|
||||
* this function gets all authentication source
|
||||
* Authentication Sources based at parameters
|
||||
@@ -940,6 +954,19 @@ class RBAC
|
||||
return $this->userObj->getAllUsersByAuthSource();
|
||||
}
|
||||
|
||||
/**
|
||||
* this function gets all users by authentication source
|
||||
*
|
||||
* @access public
|
||||
|
||||
* @param void
|
||||
* @return $this->userObj->getAllUsersByAuthSource()
|
||||
*/
|
||||
|
||||
function getListUsersByAuthSource($aSource){
|
||||
return $this->userObj->getListUsersByAuthSource($aSource);
|
||||
}
|
||||
|
||||
/**
|
||||
* this function searchs users
|
||||
*
|
||||
|
||||
@@ -161,4 +161,23 @@ class AuthenticationSource extends BaseAuthenticationSource {
|
||||
$result['LIST'] = $oCriteria2;
|
||||
return $result;
|
||||
}
|
||||
|
||||
function getAllAuthSourcesByUser(){
|
||||
$oCriteria = new Criteria('rbac');
|
||||
$oCriteria->addSelectColumn(RbacUsersPeer::USR_UID);
|
||||
$oCriteria->addSelectColumn(AuthenticationSourcePeer::AUTH_SOURCE_NAME);
|
||||
$oCriteria->addSelectColumn(AuthenticationSourcePeer::AUTH_SOURCE_PROVIDER);
|
||||
$oCriteria->addJoin(RbacUsersPeer::UID_AUTH_SOURCE, AuthenticationSourcePeer::AUTH_SOURCE_UID, Criteria::INNER_JOIN);
|
||||
|
||||
$oDataset = RbacUsersPeer::doSelectRS($oCriteria);
|
||||
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
$aAuth = array();
|
||||
while($oDataset->next()){
|
||||
$row = $oDataset->getRow();
|
||||
$aAuth[$row['USR_UID']] = $row['AUTH_SOURCE_NAME'].' ('.$row['AUTH_SOURCE_PROVIDER'].')';
|
||||
}
|
||||
return $aAuth;
|
||||
}
|
||||
|
||||
} // AuthenticationSource
|
||||
@@ -229,4 +229,27 @@ class RbacUsers extends BaseRbacUsers {
|
||||
return $aAuth;
|
||||
}
|
||||
|
||||
//Returns all users with auth_source
|
||||
function getListUsersByAuthSource($auth_source){
|
||||
$oCriteria = new Criteria('rbac');
|
||||
$oCriteria->addSelectColumn(RbacUsersPeer::USR_UID);
|
||||
|
||||
if ($auth_source=='00000000000000000000000000000000'){
|
||||
$oCriteria->add(
|
||||
$oCriteria->getNewCriterion(RbacUsersPeer::UID_AUTH_SOURCE,$auth_source, Criteria::EQUAL)->addOr(
|
||||
$oCriteria->getNewCriterion(RbacUsersPeer::UID_AUTH_SOURCE,'', Criteria::EQUAL)
|
||||
));
|
||||
}else{
|
||||
$oCriteria->add(RbacUsersPeer::UID_AUTH_SOURCE, $auth_source, Criteria::EQUAL);
|
||||
}
|
||||
$oDataset = RbacUsersPeer::doSelectRS($oCriteria);
|
||||
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$aUsers = array();
|
||||
while($oDataset->next()){
|
||||
$row = $oDataset->getRow();
|
||||
$aUsers[] = $row['USR_UID'];
|
||||
}
|
||||
return $aUsers;
|
||||
}
|
||||
|
||||
} // Users
|
||||
|
||||
@@ -237,12 +237,20 @@ try {
|
||||
$criteria = $RBAC->getAllAuthSources();
|
||||
$objects = AuthenticationSourcePeer::doSelectRS($criteria);
|
||||
$objects->setFetchmode ( ResultSet::FETCHMODE_ASSOC );
|
||||
$arr = Array();
|
||||
if (isset($_REQUEST['cmb'])){
|
||||
if ($_REQUEST['cmb'] == 'yes'){
|
||||
$started = Array();
|
||||
$started['AUTH_SOURCE_UID'] = '';
|
||||
$started['AUTH_SOURCE_SHOW'] = G::LoadTranslation('ID_ALL');
|
||||
$arr[] = $started;
|
||||
}
|
||||
}
|
||||
$started = Array();
|
||||
$started['AUTH_SOURCE_UID'] = '00000000000000000000000000000000';
|
||||
//$started['AUTH_SOURCE_NAME'] = 'ProcessMaker';
|
||||
//$started['AUTH_SOURCE_TYPE'] = 'MYSQL';
|
||||
$started['AUTH_SOURCE_SHOW'] = 'ProcessMaker (MYSQL)';
|
||||
$arr = Array();
|
||||
$arr[] = $started;
|
||||
while ($objects->next()){
|
||||
$row = $objects->getRow();
|
||||
@@ -306,6 +314,7 @@ try {
|
||||
require_once 'classes/model/LoginLog.php';
|
||||
require_once 'classes/model/Department.php';
|
||||
require_once 'classes/model/AppCacheView.php';
|
||||
global $RBAC;
|
||||
G::LoadClass('configuration');
|
||||
$co = new Configurations();
|
||||
$config = $co->getConfiguration('usersList', 'pageSize','',$_SESSION['USER_LOGGED']);
|
||||
@@ -313,20 +322,29 @@ try {
|
||||
$start = isset($_REQUEST['start']) ? $_REQUEST['start'] : 0;
|
||||
$limit = isset($_REQUEST['limit']) ? $_REQUEST['limit'] : $limit_size;
|
||||
$filter = isset($_REQUEST['textFilter']) ? $_REQUEST['textFilter'] : '';
|
||||
$auths = isset($_REQUEST['auths']) ? $_REQUEST['auths'] : '';
|
||||
$aUsers = Array();
|
||||
if ($auths != ''){
|
||||
$aUsers = $RBAC->getListUsersByAuthSource($auths);
|
||||
}
|
||||
$oCriteria = new Criteria('workflow');
|
||||
$oCriteria->addSelectColumn('COUNT(*) AS CNT');
|
||||
if ($filter != ''){
|
||||
$cc = $oCriteria->getNewCriterion(UsersPeer::USR_USERNAME,'%'.$filter.'%',Criteria::LIKE)->addOr(
|
||||
$oCriteria->getNewCriterion(UsersPeer::USR_FIRSTNAME,'%'.$filter.'%',Criteria::LIKE)->addOr(
|
||||
$oCriteria->getNewCriterion(UsersPeer::USR_LASTNAME,'%'.$filter.'%',Criteria::LIKE)));
|
||||
$oCriteria->getNewCriterion(UsersPeer::USR_FIRSTNAME,'%'.$filter.'%',Criteria::LIKE)->addOr(
|
||||
$oCriteria->getNewCriterion(UsersPeer::USR_LASTNAME,'%'.$filter.'%',Criteria::LIKE)));
|
||||
$oCriteria->add($cc);
|
||||
}
|
||||
$oCriteria->add(UsersPeer::USR_STATUS, array('CLOSED'), Criteria::NOT_IN);
|
||||
$oDataset = UsersPeer::DoSelectRs ($oCriteria);
|
||||
$oDataset->setFetchmode (ResultSet::FETCHMODE_ASSOC);
|
||||
$oDataset->next();
|
||||
$row = $oDataset->getRow();
|
||||
$totalRows = $row['CNT'];
|
||||
if ($auths != ''){
|
||||
$totalRows = sizeof($aUsers);
|
||||
}else{
|
||||
$oDataset = UsersPeer::DoSelectRs ($oCriteria);
|
||||
$oDataset->setFetchmode (ResultSet::FETCHMODE_ASSOC);
|
||||
$oDataset->next();
|
||||
$row = $oDataset->getRow();
|
||||
$totalRows = $row['CNT'];
|
||||
}
|
||||
$oCriteria->clearSelectColumns();
|
||||
$oCriteria->addSelectColumn(UsersPeer::USR_UID);
|
||||
$oCriteria->addSelectColumn(UsersPeer::USR_USERNAME);
|
||||
@@ -345,10 +363,21 @@ try {
|
||||
$oCriteria->add(UsersPeer::USR_STATUS, array('CLOSED'), Criteria::NOT_IN);
|
||||
if ($filter != ''){
|
||||
$cc = $oCriteria->getNewCriterion(UsersPeer::USR_USERNAME,'%'.$filter.'%',Criteria::LIKE)->addOr(
|
||||
$oCriteria->getNewCriterion(UsersPeer::USR_FIRSTNAME,'%'.$filter.'%',Criteria::LIKE)->addOr(
|
||||
$oCriteria->getNewCriterion(UsersPeer::USR_LASTNAME,'%'.$filter.'%',Criteria::LIKE)));
|
||||
$oCriteria->getNewCriterion(UsersPeer::USR_FIRSTNAME,'%'.$filter.'%',Criteria::LIKE)->addOr(
|
||||
$oCriteria->getNewCriterion(UsersPeer::USR_LASTNAME,'%'.$filter.'%',Criteria::LIKE)));
|
||||
$oCriteria->add($cc);
|
||||
}
|
||||
$sw_add = false;
|
||||
for ($i=0; $i < sizeof($aUsers); $i++){
|
||||
if ($i>0){
|
||||
$tmpL = $tmpL->addOr($oCriteria->getNewCriterion(UsersPeer::USR_UID, $aUsers[$i],Criteria::EQUAL));
|
||||
}else{
|
||||
$uList = $oCriteria->getNewCriterion(UsersPeer::USR_UID, $aUsers[$i],Criteria::EQUAL);
|
||||
$tmpL = $uList;
|
||||
$sw_add = true;
|
||||
}
|
||||
}
|
||||
if ($sw_add) $oCriteria->add($uList);
|
||||
$oCriteria->setOffset($start);
|
||||
$oCriteria->setLimit($limit);
|
||||
$oDataset = UsersPeer::DoSelectRs ($oCriteria);
|
||||
@@ -360,6 +389,7 @@ try {
|
||||
$aCases = $Cases->getTotalCasesByAllUsers();
|
||||
$Department = new Department();
|
||||
$aDepart = $Department->getAllDepartmentsByUser();
|
||||
$aAuthSources = $RBAC->getAllAuthSourcesByUser();
|
||||
|
||||
$rows = Array();
|
||||
while($oDataset->next()){
|
||||
@@ -369,6 +399,7 @@ try {
|
||||
$rows[$index]['LAST_LOGIN'] = isset($aLogin[$rows[$index]['USR_UID']]) ? $aLogin[$rows[$index]['USR_UID']] : '';
|
||||
$rows[$index]['TOTAL_CASES'] = isset($aCases[$rows[$index]['USR_UID']]) ? $aCases[$rows[$index]['USR_UID']] : 0;
|
||||
$rows[$index]['DEP_TITLE'] = isset($aDepart[$rows[$index]['USR_UID']]) ? $aDepart[$rows[$index]['USR_UID']] : '';
|
||||
$rows[$index]['USR_AUTH_SOURCE'] = isset($aAuthSources[$rows[$index]['USR_UID']]) ? $aAuthSources[$rows[$index]['USR_UID']] : 'ProcessMaker (MYSQL)';
|
||||
}
|
||||
echo '{users: '.G::json_encode($rows).', total_users: '.$totalRows.'}';
|
||||
break;
|
||||
|
||||
@@ -310,6 +310,7 @@ Ext.onReady(function(){
|
||||
valueField:'AUTH_SOURCE_UID',
|
||||
allowBlank: false,
|
||||
submitValue: true,
|
||||
width: 350,
|
||||
//hiddenValue: 'AUTH_SOURCE_UID',
|
||||
triggerAction: 'all',
|
||||
emptyText: _('ID_SELECT_AUTH_SOURCE'),
|
||||
@@ -329,7 +330,7 @@ Ext.onReady(function(){
|
||||
xtype: 'textfield',
|
||||
fieldLabel: _('ID_AUTHENTICATION_DN'),
|
||||
name: 'auth_dn',
|
||||
width: 350,
|
||||
width: 380,
|
||||
allowBlank: true,
|
||||
enableKeyEvents: true,
|
||||
listeners: {keyup: function(f,e){ ReportChanges(); }}
|
||||
|
||||
@@ -52,8 +52,11 @@ var user_admin = '00000000000000000000000000000001';
|
||||
var pageSize;
|
||||
var fullNameFormat;
|
||||
var dateFormat;
|
||||
var comboAuthSources;
|
||||
var storeAuthSources;
|
||||
|
||||
Ext.onReady(function(){
|
||||
Ext.state.Manager.setProvider(new Ext.state.CookieProvider());
|
||||
Ext.QuickTips.init();
|
||||
|
||||
fullNameFormat = CONFIG.fullNameFormat;
|
||||
@@ -122,7 +125,7 @@ Ext.onReady(function(){
|
||||
id: 'searchTxt',
|
||||
ctCls:'pm_search_text_field',
|
||||
allowBlank: true,
|
||||
width: 150,
|
||||
width: 100,
|
||||
emptyText: _('ID_ENTER_SEARCH_TERM'),//'enter search term',
|
||||
listeners: {
|
||||
specialkey: function(f,e){
|
||||
@@ -184,7 +187,8 @@ Ext.onReady(function(){
|
||||
{name : 'LAST_LOGIN'},
|
||||
{name : 'USR_STATUS'},
|
||||
{name : 'TOTAL_CASES'},
|
||||
{name : 'DUE_DATE_OK'}
|
||||
{name : 'DUE_DATE_OK'},
|
||||
{name : 'USR_AUTH_SOURCE'}
|
||||
]
|
||||
})
|
||||
});
|
||||
@@ -215,6 +219,38 @@ Ext.onReady(function(){
|
||||
|
||||
comboPageSize.setValue(pageSize);
|
||||
|
||||
storeAuthSources = new Ext.data.GroupingStore({
|
||||
autoLoad: true,
|
||||
proxy : new Ext.data.HttpProxy({
|
||||
url: 'users_Ajax?function=authSources&cmb=yes'
|
||||
}),
|
||||
reader : new Ext.data.JsonReader( {
|
||||
root: 'sources',
|
||||
fields: [
|
||||
{name: 'AUTH_SOURCE_UID'},
|
||||
{name: 'AUTH_SOURCE_SHOW'}
|
||||
]
|
||||
})
|
||||
});
|
||||
|
||||
comboAuthSources = new Ext.form.ComboBox({
|
||||
mode: 'local',
|
||||
triggerAction: 'all',
|
||||
store: storeAuthSources,
|
||||
valueField: 'AUTH_SOURCE_UID',
|
||||
displayField: 'AUTH_SOURCE_SHOW',
|
||||
//emptyText: 'All',
|
||||
width: 160,
|
||||
editable: false,
|
||||
value: _('ID_ALL'),
|
||||
listeners:{
|
||||
select: function(c,d,i){
|
||||
store.setBaseParam('auths',d.data['AUTH_SOURCE_UID']);
|
||||
UpdateAuthSource(d.data['AUTH_SOURCE_UID']);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
bbarpaging = new Ext.PagingToolbar({
|
||||
pageSize: pageSize,
|
||||
store: store,
|
||||
@@ -231,7 +267,7 @@ Ext.onReady(function(){
|
||||
},
|
||||
columns: [
|
||||
{id:'USR_UID', dataIndex: 'USR_UID', hidden:true, hideable:false},
|
||||
{header: '', dataIndex: 'USR_UID', width: 30, align:'center', sortable: false, renderer: photo_user},
|
||||
//{header: '', dataIndex: 'USR_UID', width: 30, align:'center', sortable: false, renderer: photo_user},
|
||||
{header: _('ID_USER_NAME'), dataIndex: 'USR_USERNAME', width: 90, hidden:false, align:'left'},
|
||||
{header: _('ID_FULL_NAME'), dataIndex: 'USR_USERNAME', width: 175, align:'left', renderer: full_name},
|
||||
{header: _('ID_EMAIL'), dataIndex: 'USR_EMAIL', width: 120, hidden: true, align: 'left'},
|
||||
@@ -239,6 +275,7 @@ Ext.onReady(function(){
|
||||
{header: _('ID_ROLE'), dataIndex: 'USR_ROLE', width: 180, hidden:false, align:'left'},
|
||||
{header: _('ID_DEPARTMENT'), dataIndex: 'DEP_TITLE', width: 150, hidden:true, align:'left'},
|
||||
{header: _('ID_LAST_LOGIN'), dataIndex: 'LAST_LOGIN', width: 108, hidden:false, align:'center', renderer: render_lastlogin},
|
||||
{header: _('ID_AUTHENTICATION_SOURCE'), dataIndex: 'USR_AUTH_SOURCE', width: 108, hidden: true, align: 'left'},
|
||||
{header: _('ID_CASES'), dataIndex: 'TOTAL_CASES', width: 45, hidden:false, align:'right'},
|
||||
{header: _('ID_DUE_DATE'), dataIndex: 'USR_DUE_DATE', width: 108, hidden:false, align:'center', renderer: render_duedate}
|
||||
]
|
||||
@@ -263,7 +300,7 @@ Ext.onReady(function(){
|
||||
store: store,
|
||||
cm: cmodel,
|
||||
sm: smodel,
|
||||
tbar: [newButton, '-',summaryButton,'-', editButton, deleteButton,'-',groupsButton,'-',authenticationButton, {xtype: 'tbfill'}, searchText,clearTextButton,searchButton],
|
||||
tbar: [newButton, '-',summaryButton,'-', editButton, deleteButton,/*'-',groupsButton,'-',authenticationButton,*/ {xtype: 'tbfill'},_('ID_AUTH_SOURCES')+': ',comboAuthSources,'-', searchText,clearTextButton,searchButton],
|
||||
bbar: bbarpaging,
|
||||
listeners: {
|
||||
rowdblclick: SummaryTabOpen
|
||||
@@ -391,10 +428,10 @@ AuthUserPage = function(value){
|
||||
}
|
||||
};
|
||||
|
||||
//Renderer Active/Inactive Role
|
||||
photo_user = function(value){
|
||||
return '<img border="0" src="users_ViewPhotoGrid?h=' + Math.random() +'&pUID=' + value + '" width="20" />';
|
||||
};
|
||||
////Renderer Active/Inactive Role
|
||||
//photo_user = function(value){
|
||||
// return '<img border="0" src="users_ViewPhotoGrid?h=' + Math.random() +'&pUID=' + value + '" width="20" />';
|
||||
//};
|
||||
|
||||
//Render Full Name
|
||||
full_name = function(v,x,s){
|
||||
@@ -453,3 +490,9 @@ UpdatePageConfig = function(pageSize){
|
||||
params: {'function':'updatePageSize', size: pageSize}
|
||||
});
|
||||
};
|
||||
|
||||
//Update Authentication Source Filter
|
||||
UpdateAuthSource = function(index){
|
||||
searchText.reset();
|
||||
infoGrid.store.load({params: {auths: index}});
|
||||
};
|
||||
Reference in New Issue
Block a user