예제 #1
0
 * 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.
 * 
 */
/**
 * @package    classes.model
 */
$G_MAIN_MENU = "rbac";
$G_SUB_MENU = "rbac.appEdit";
$G_MENU_SELECTED = 1;
$appid = isset($_GET[0]) ? $_GET[0] : '';
//$URI_VARS[0];
$HTTP_SESSION_VARS['CURRENT_APPLICATION'] = $appid;
$dbc = new DBConnection(DB_HOST, DB_RBAC_USER, DB_RBAC_PASS, DB_RBAC_NAME);
G::LoadClassRBAC("applications");
$obj = new RBAC_Application();
$obj->SetTo($dbc);
$obj->Load($appid);
$obj->Fields['EDIT_ROLES'] = G::LoadMessageXml('ID_ROLES');
$obj->Fields['EDIT_PERMISSIONS'] = G::LoadMessageXml('ID_PERMISSIONS');
$G_PUBLISH = new Publisher();
$G_PUBLISH->SetTo($dbc);
$G_PUBLISH->AddContent("xmlform", "xmlform", "rbac/appEdit", "", $obj->Fields, "../appEdit2");
$content = '';
//G::LoadContent( "rbac/myApp" );
G::RenderPage("publish");
예제 #2
0
 * 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_MAIN_MENU = "rbac";
$G_SUB_MENU = "rbac.userEdit";
$G_MENU_SELECTED = 0;
$uid = $HTTP_SESSION_VARS['CURRENT_USER'];
$dbc = new DBConnection(DB_HOST, DB_RBAC_USER, DB_RBAC_PASS, DB_RBAC_NAME);
$ses = new DBSession($dbc);
$stQry = "SELECT UID, USR_USE_LDAP FROM USERS where UID = {$uid} ";
$dset = $ses->Execute($stQry);
$row = $dset->Read();
$useLdap = $row['USR_USE_LDAP'] == 'Y';
$access = $RBAC->userCanAccess("RBAC_CREATE_USERS");
G::LoadClassRBAC("user");
$obj = new RBAC_User();
$obj->SetTo($dbc);
$obj->Load($uid);
$G_PUBLISH = new Publisher();
$G_PUBLISH->SetTo($dbc);
$G_PUBLISH->AddContent("xmlform", "xmlform", "rbac/userChangeLdap", "", $obj->Fields, "userChangeLdap2");
G::RenderPage("publish");
예제 #3
0
 * 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_MAIN_MENU = "rbac";
$G_BACK_PAGE = "rbac/permList";
$G_SUB_MENU = "cancel";
$G_MENU_SELECTED = 1;
$uid = isset($_GET['UID']) ? $_GET['UID'] : '';
//$URI_VARS[0];
$_SESSION['CURRENT_PERM_PARENT'] = $uid;
$dbc = new DBConnection(DB_HOST, DB_RBAC_USER, DB_RBAC_PASS, DB_RBAC_NAME);
G::LoadClassRBAC("permissions");
$obj = new RBAC_Permission();
$obj->SetTo($dbc);
$obj->Load($uid);
$obj->Fields['UID'] = $_SESSION['CURRENT_APPLICATION'];
$G_PUBLISH = new Publisher();
$G_PUBLISH->SetTo($dbc);
$G_PUBLISH->AddContent("xmlform", "xmlform", "rbac/permEdit", "", $obj->Fields, "permEdit2");
$content = '';
//G::LoadContent( "rbac/myApp" );
G::RenderPage("publish");
예제 #4
0
global $rolid;
global $parents;
//global $dbc;
global $ses;
global $accessChangeRole;
$appid = $_SESSION['CURRENT_APPLICATION'];
$rolid = $_SESSION['CURRENT_ROLE'];
$parents = $_SESSION['CURRENT_ROLE_PARENTS'];
//$pathViewChart = "../";
//$nodo = $URI_VARS[0];
//if ($nodo == "")
$pathViewChart = "";
//Obtener nombre de la applicacion
$dbc = new DBConnection(DB_HOST, DB_RBAC_USER, DB_RBAC_PASS, DB_RBAC_NAME);
G::LoadClassRBAC('applications');
G::LoadClassRBAC('roles');
$obj = new RBAC_Application();
$obj->SetTo($dbc);
$obj->Load($appid);
$_SESSION['STR_APP'] = $obj->Fields['APP_CODE'];
$obj = new RBAC_Role();
$obj->SetTo($dbc);
$obj->Load($rolid);
$_SESSION['STR_ROL'] = $obj->Fields['ROL_CODE'];
//$appCode = G::LoadMessage (13);
//print "<center class='subtitle'>$appCode</center>";
$ses = new DBSession();
$ses->SetTo($dbc);
$dbc = new DBConnection(DB_HOST, DB_RBAC_USER, DB_RBAC_PASS, DB_RBAC_NAME);
$ses = new DBSession();
$ses->SetTo($dbc);
예제 #5
0
 * 
 * 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.
 * 
 */
$frm = $_POST['form'];
$rolid = $frm['USR_ROLE'];
$dbc = new DBConnection(DB_HOST, DB_RBAC_USER, DB_RBAC_PASS, DB_RBAC_NAME);
G::LoadClassRBAC('user');
$obj = new RBAC_User();
$obj->SetTo($dbc);
$obj->assignUserRole($_SESSION['CURRENT_USER'], $rolid);
//header('location: userViewRole.html');
?>
<script language='Javascript'>
  //parent.myPanel.remove();
  parent.window.location = 'userEdit.html';  
</script>
예제 #6
0
 * 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");
예제 #7
0
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'>&nbsp;";
    $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();
}
예제 #8
0
 * 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.
 * 
 */
header("location: appList.html");
die;
/*Falta revisar la clase RBAC_Application*/
$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 aplicacion
G::LoadClassRBAC('applications');
$obj = new RBAC_Application();
$obj->SetTo($dbc);
$res = $obj->applicationCodeRepetido($code);
if ($res != 0) {
    G::SendMessage(15, "error");
    header("location: appNew.php");
    die;
}
$appid = $obj->createApplication($code, $description);
$_SESSION['CURRENT_APPLICATION'] = $appid;
header("location: appList.html");
예제 #9
0
 *
 * 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'];
$dbc = new DBConnection(DB_HOST, DB_RBAC_USER, DB_RBAC_PASS, DB_RBAC_NAME);
$roleid = $_SESSION['CURRENT_ROLE_PARENT'];
$appid = $_SESSION['CURRENT_APPLICATION'];
$code = strtoupper($frm['ROL_CODE']);
$descrip = $frm['ROL_DESCRIPTION'];
//crear nuevo rol
G::LoadClassRBAC("roles");
$obj = new RBAC_Role();
$obj->SetTo($dbc);
$res = $obj->roleCodeRepetido($code);
if ($res != 0 && $res != $roleid) {
    G::SendMessage(14, "error");
    header("location: roleList.php");
    die;
}
$uid = $obj->editRole($roleid, $appid, $code, $descrip);
header("location: roleList.html");