case -3: //inactive //inactive case -4: //due G::SendMessageXml('ID_USER_INACTIVE', 'warning'); break; } if ($res < 0) { header('location: login.html'); die; } $uid = $res; $_SESSION['USER_LOGGED'] = $uid; $res = $RBAC->userCanAccess('RBAC_LOGIN'); if ($res != 1) { G::SendMessageXml('ID_USER_HAVENT_RIGHTS_PAGE', 'error'); header('location: login.html'); die; } $_SESSION['USER_NAME'] = $usr; $file = PATH_RBAC . PATH_SEP . 'class.authentication.php'; require_once $file; $obj = new authenticationSource(); $obj->SetTo($dbc); $res = $obj->verifyStructures(); if ($RBAC->userCanAccess("RBAC_READONLY") == 1) { header('location: ../rbac/userList'); } else { header('location: ../rbac/appList'); }
function searchText($searchText) { global $_SESSION; global $RBAC; $curAuthSource = $_SESSION['CURRENT_AUTH_SOURCE']; $dbc = new DBConnection(DB_HOST, DB_RBAC_USER, DB_RBAC_PASS, DB_RBAC_NAME); $tpl = new TemplatePower(PATH_TPL . 'authListUsers.html'); $tpl->prepare(); $tpl->assign("STYLE_CSS", defined('STYLE_CSS') ? STYLE_CSS : 'simple'); $tpl->assign("title", 'Search Results'); //authentication source G::LoadClassRBAC('authentication'); $obj = new authenticationSource(); $obj->SetTo($dbc); $data = $obj->searchUsers($curAuthSource, $searchText); if ($data['codError'] == 0 && isset($data['rows']) && !is_array($data['rows'])) { $tpl->newBlock("empty-rows"); $tpl->assign("title", 'Search Results'); $tpl->assign("empty-rows-text", 'no records found'); $tpl->printToScreen(); die; } if ($data['codError'] != 0) { $tpl->newBlock("error"); $tpl->assign("title", 'Log Error'); $tpl->assign("text", "<font color='Red'>" . $data['rows'] . "</font>"); $tpl->printToScreen(); die; } //build the options to create...an user, list the applications and their roles.. $ses = new DBSession($dbc); $ses2 = new DBSession($dbc); $dset = $ses->execute("SELECT * from APPLICATION where APP_CODE != 'RBAC' "); $appRow = $dset->Read(); $checkboxs = "<br><input type='checkbox' @@disabled name='C-@@Y' id='C-@@Y' onclick='emptyDropdowns( \"@@X\");' ><input type='hidden' name='H-@@Y' id='H-@@Y' value='@@X' ><input type='hidden' name='E-@@Y' id='E-@@Y' value='' >"; $inputs = "<div id='D-@@Y'>@@validuser</div><input type='text' name='T-@@Y' id='T-@@Y' value=\"@@Z\" onchange='verifyUserName ( this, \"@@Y\" );' size='14' maxlength='16'> "; $options = "<table cellpadding='0' cellspacing='0'><tr>"; $options .= ""; while (is_array($appRow)) { $appid = $appRow['UID']; $selectId = 'S-@@Y-' . $appid; $dset2 = $ses2->execute('SELECT * from ROLE where ROL_APPLICATION = ' . $appid); $rolRow = $dset2->Read(); $selectEnabled = false; if (is_array($rolRow)) { $options .= '<td>' . $appRow['APP_CODE'] . '<br>'; $options .= "<select name='{$selectId}' id='{$selectId}' @@disabled onchange='flipCheckbox( \"@@Y\");' >\n"; $options .= "<option value='0'>select a Role</option>"; $selectEnabled = true; } while (is_array($rolRow)) { $options .= "<option value='" . $rolRow['UID'] . "'>" . $rolRow['ROL_CODE'] . "</option>"; $rolRow = $dset2->Read(); } if ($selectEnabled) { $options .= "</select>\n<td>"; } $appRow = $dset->Read(); } $options .= '</tr></table>'; $i = 0; if (isset($data['rows'])) { foreach ($data['rows'] as $row) { $tpl->newBlock("users"); if (++$i % 2 == 0) { $tpl->assign("class", 'Row2'); } else { $tpl->assign("class", 'Row1'); } $tpl->assign("index", $i); $tpl->assign("dn", $row['dn']); $tpl->assign("name", $row['attr']['givenName']); $tpl->assign("lastname", $row['attr']['sn']); $tpl->assign("fullname", $row['attr']['cn']); $tpl->assign("email", $row['attr']['mail']); $tpl->assign("uid", $row['attr']['uid']); //verificar uid $userid = $row['attr']['uid']; $res = $RBAC->UserNameRepetido(0, $userid); $input = str_replace('@@Z', $userid, str_replace('@@X', $row['dn'], str_replace('@@Y', $i, $inputs))); $input = str_replace('@@validuser', $res == 0 ? "<font color='green'>valid user</font>" : "<font color='red'>user already used</font>", $input); $checkbox = str_replace('@@X', $row['dn'], str_replace('@@Y', $i, $checkboxs)); $checkbox = str_replace('@@disabled', $res != 0 ? 'disabled' : '', $checkbox); $option = str_replace('@@X', $row['dn'], str_replace('@@Y', $i, $options)); // $option = str_replace ( '@@disabled', ( $res <> 0 ? 'disabled' : ''), $option ); $tpl->assign("checkbox", $checkbox); $tpl->assign("input", $input); $tpl->assign("options", $option); } } $tpl->gotoBlock("_ROOT"); $tpl->newBlock("start-users"); $tpl->assign("dummy", 'dummy'); $tpl->gotoBlock("_ROOT"); $tpl->newBlock("end-users"); $tpl->assign("dummy", 'dummy'); $tpl->printToScreen(); }
* 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. * */ $frm = $_POST['form']; $code = strtoupper($frm['APP_CODE']); $description = $frm['APP_DESCRIPTION']; $dbc = new DBConnection(DB_HOST, DB_RBAC_USER, DB_RBAC_PASS, DB_RBAC_NAME); //crear nueva authentication source G::LoadClassRBAC('authentication'); $obj = new authenticationSource(); $obj->SetTo($dbc); $res = $obj->newSource($frm); if ($res <= 0) { //G::SendMessage ( -$res, "error"); header("location: authNew"); die; } $HTTP_SESSION_VARS['CURRENT_AUTH_SOURCE'] = $res; header("location: authenticationList.html");
* 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. * */ $frm = $_POST['form']; $code = strtoupper($frm['APP_CODE']); $description = $frm['APP_DESCRIPTION']; $dbc = new DBConnection(DB_HOST, DB_RBAC_USER, DB_RBAC_PASS, DB_RBAC_NAME); G::LoadClassRBAC('authentication'); $obj = new authenticationSource(); $obj->SetTo($dbc); $res = $obj->editSource($_SESSION['CURRENT_AUTH_SOURCE'], $frm); if ($res <= 0) { G::SendMessageXml('ID_USER_HAVENT_RIGHTS_PAGE', 'error'); header('location: authEdit'); die; } header('location: authTest.html'); //header('location: authenticationList.html');
*/ G::LoadSystem('inputfilter'); $filter = new InputFilter(); $HTTP_SESSION_VARS = $filter->xssFilterHard($HTTP_SESSION_VARS); global $G_TABLE; global $G_CONTENT; global $HTTP_SESSION_VARS; $tpl = new TemplatePower(PATH_TPL . 'testAuthenticationSource.html'); $tpl->prepare(); $tpl->assign('STYLE_CSS', defined('STYLE_CSS') ? STYLE_CSS : ''); $tpl->assign('title', $G_TABLE->title); $curAuthSource = $HTTP_SESSION_VARS['CURRENT_AUTH_SOURCE']; $dbc = new DBConnection(DB_HOST, DB_RBAC_USER, DB_RBAC_PASS, DB_RBAC_NAME); //crear nueva authentication source G::LoadClassRBAC('authentication'); $obj = new authenticationSource(); $obj->SetTo($dbc); $res = $obj->testSource($curAuthSource); //print "<textarea rows=50 cols=60>"; print_r ($res ); //print "</textarea >"; foreach ($res as $line) { if (stristr($line, 'error') !== false) { $line = "<font color='Red'>" . $line . '</font>'; } if (stristr($line, 'sucess') !== false) { $line = "<font color='Green'>" . $line . '</font>'; } $tpl->newBlock("lines"); $tpl->assign("text", $line); } $tpl->gotoBlock("_ROOT");
} $userId = $_SESSION['CURRENT_USER']; $tpl = new TemplatePower(PATH_TPL . 'testAuthenticationSource.html'); $tpl->prepare(); $tpl->assign("STYLE_CSS", STYLE_CSS); $tpl->assign("title", $G_TABLE->title); $curAuthSource = $HTTP_SESSION_VARS['CURRENT_AUTH_SOURCE']; $dbc = new DBConnection(DB_HOST, DB_RBAC_USER, DB_RBAC_PASS, DB_RBAC_NAME); //Class user G::LoadClassRBAC("user"); $user = new RBAC_User(); $user->SetTo($dbc); $user->Load($userId); //crear nueva authentication source G::LoadClassRBAC('authentication'); $obj = new authenticationSource(); $obj->SetTo($dbc); $res = $obj->verifyPassword($userId, $user->Fields['USR_LDAP_DN'], $strPass, $user->Fields['USR_LDAP_SOURCE']); //print "<textarea rows=10 cols=60>"; print_r ($obj->vlog ); //print "</textarea >"; foreach ($obj->vlog as $line) { if (stristr($line, 'error') !== false) { $line = "<font color='Red'>" . $line . '</font>'; } if (stristr($line, 'sucess') !== false) { $line = "<font color='Green'>" . $line . '</font>'; } $tpl->newBlock("lines"); $tpl->assign("text", $line); } $tpl->gotoBlock("_ROOT");
<?php /** * authDel.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. * */ $dbc = new DBConnection(DB_HOST, DB_RBAC_USER, DB_RBAC_PASS, DB_RBAC_NAME); G::LoadClassRBAC('authentication'); $obj = new authenticationSource(); $obj->SetTo($dbc); $obj->removeSource($_GET['UID']); header('location: authenticationList.html');
* */ $G_MAIN_MENU = 'rbac'; $G_SUB_MENU = 'rbac.authSource'; $G_BACK_PAGE = 'rbac/authenticationList.html'; $G_MENU_SELECTED = 2; $G_SUB_MENU_SELECTED = 1; $appid = isset($_GET[0]) ? $_GET[0] : ''; //$URI_VARS[0]; if ($appid == '' && $_SESSION['CURRENT_AUTH_SOURCE'] != '') { $appid = $_SESSION['CURRENT_AUTH_SOURCE']; } $_SESSION['CURRENT_AUTH_SOURCE'] = $appid; $dbc = new DBConnection(DB_HOST, DB_RBAC_USER, DB_RBAC_PASS, DB_RBAC_NAME); G::LoadClassRBAC('authentication'); $obj = new authenticationSource(); $obj->SetTo($dbc); $obj->Load($appid); $G_PUBLISH = new Publisher(); $G_PUBLISH->SetTo($dbc); $G_PUBLISH->AddContent('view', 'testAuthenticationSource'); G::RenderPage('publish'); /* require_once('Net/LDAP.php'); $rootDn = 'OU=Ventas,DC=colosa,DC=net'; $config = array( 'dn' => '*****@*****.**', 'password' => 'Colosa1', 'host' => '192.168.0.50', 'base' => $rootDn, 'options' => array('LDAP_OPT_REFERRALS' => 0),