Esempio n. 1
0
	function get_object_id( $var_1 = null, $var_2 = null, $var_3 = null ) {
		if ( checkJversion() == 2 ) {
			$return		=	$var_2;
		} else {
			$return		=	$this->_acl->get_object_id( $var_1, $var_2, $var_3 );
		}

		return $return;
	}
Esempio n. 2
0
            
              <td>&nbsp;</td>
              <td>
                     <?php 
 //Place the ACO selector here
 $gacl_temp = new gacl_api();
 $list_aco_objects = $gacl_temp->get_objects(NULL, 0, 'ACO');
 foreach ($list_aco_objects as $key => $value) {
     asort($list_aco_objects[$key]);
 }
 echo "<select name='access_control[" . $index . "]'>";
 foreach ($list_aco_objects as $section => $array_acos) {
     $aco_section_data = $gacl_temp->get_section_data($section, 'ACO');
     $aco_section_title = $aco_section_data[3];
     foreach ($array_acos as $aco) {
         $aco_id = $gacl_temp->get_object_id($section, $aco, 'ACO');
         $aco_data = $gacl_temp->get_object_data($aco_id, 'ACO');
         $aco_title = $aco_data[0][3];
         $select = '';
         if ($rule->access_control() == $section . ":" . $aco) {
             $select = 'selected';
         }
         echo "<option value='" . attr($section) . ":" . attr($aco) . "' " . $select . ">" . xlt($aco_section_title) . ": " . xlt($aco_title) . "</option>";
     }
 }
 echo "</select>";
 ?>
              </td> 
             <td><input style="display:none" name="id[<?php 
 echo $index;
 ?>
$gacl_api = new gacl_api($gacl_options);
if ($op == 'editgroup') {
    $group = new usergroup($DB);
    $group->id = $_GET['group_id'];
    $arr_group = $group->selectusergroup();
    $smarty->assign("function_title", 'Edit Group');
} else {
    $smarty->assign("function_title", 'Add Group');
}
$arr_data = $gacl_api->get_objects('', 1, 'aco');
$arr_aco = array();
$arr_tmp = $arr_data['system'];
$arr_checked = array();
for ($i = 0; $i < count($arr_tmp); $i++) {
    $obj_value = $arr_tmp[$i];
    $obj_id = $gacl_api->get_object_id('system', $obj_value, 'aco');
    $arr_obj = $gacl_api->get_object_data($obj_id, 'aco');
    $arr_aco[$obj_value] = $arr_obj[0][3];
    if ($op == 'editgroup') {
        $aro_group_id = $gacl_api->get_group_id($group->id, $group->id, 'aco');
        $sqlString = "SELECT a.id, a.allow, a.return_value FROM ooo_acl a LEFT JOIN ooo_aco_map ac ON ac.acl_id=a.id LEFT JOIN ooo_axo_map ax ON ax.acl_id=a.id LEFT JOIN ooo_aro_groups_map arg ON arg.acl_id=a.id LEFT JOIN ooo_aro_groups rg ON rg.id=arg.group_id LEFT JOIN ooo_axo_groups_map axg ON axg.acl_id=a.id WHERE a.enabled=1 AND (ac.section_value='system' AND ac.value='{$obj_value}') AND (rg.id = {$aro_group_id}) AND ((ax.section_value IS NULL AND ax.value IS NULL) AND axg.group_id IS NULL) ORDER BY (rg.rgt-rg.lft) ASC, a.updated_date DESC LIMIT 1";
        $rs = $DB->Execute($sqlString);
        if ($rs) {
            if (!$rs->EOF) {
                $arr_result = $rs->FetchRow();
                if ($arr_result['allow'] == 1) {
                    $arr_checked[] = $obj_value;
                }
            }
        }
    }
Esempio n. 4
0
 *   |-Obi-wan ARO
 *   |-Luke ARO			[ALLOW: Guns]
 *   |-R2D2 ARO			[ALLOW: Engines]
 *   '-C3PO ARO
 *
 * So we need to reassign Obi-wan and Luke from the Passengers Group, to the
 * Jedi group.
 *
 * So we do this by editing Obi-wans and Lukes object which links them to the Passengers Section.
 * edit_object($object_id, $section_value, $name, $value=0, $order=0, $hidden=0, $object_type) 
 */
/*
 * First we need the object_id's!
 * get_object_id($section_value, $value, $object_type)
 */
$result = $gacl_api->get_object_id('passengers', 'obi-wan', 'aro');
if ($outputDebug == TRUE) {
    if ($result !== FALSE) {
        echo "Got 'Passengers > Obi-wan' objectid!<br>\n";
    } else {
        echo "Error getting 'Passengers > Obi-wan' objectid.<br>\n";
    }
}
$obiWanObjectId = $result;
unset($result);
$result = $gacl_api->get_object_id('passengers', 'luke', 'aro');
if ($outputDebug == TRUE) {
    if ($result !== FALSE) {
        echo "Got 'Passengers > Luke' objectid!<br>\n";
    } else {
        echo "Error getting 'Passengers > Luke' objectid.<br>\n";
Esempio n. 5
0
 function remove()
 {
     // Remove user, the remove from gacl
     $userName = trim($this->request->args[0]);
     $users = $this->application->db->query("From UserModel as user where user.name='" . $userName . "'");
     $user = $users[0];
     $this->application->db->delete($user);
     require_once "lib/phpgacl/gacl_api.class.php";
     $api = new gacl_api(array());
     $id = $api->get_object_id("user", $userName, "ARO");
     $api->del_object($id, "ARO");
     $this->render("user/removed", array("user" => $userName), "SMARTY");
 }
Esempio n. 6
0
function aco_listings_xml($group, $return_value, $err)
{
    global $phpgacl_location;
    include_once "{$phpgacl_location}/gacl_api.class.php";
    $gacl = new gacl_api();
    //collect and sort all aco objects
    $list_aco_objects = $gacl->get_objects(NULL, 0, 'ACO');
    foreach ($list_aco_objects as $key => $value) {
        asort($list_aco_objects[$key]);
    }
    //collect aco objects within the specified acl(already sorted)
    $acl_id = $gacl->search_acl(FALSE, FALSE, FALSE, FALSE, $group, FALSE, FALSE, FALSE, $return_value);
    $acl = $gacl->get_acl($acl_id[0]);
    $active_aco_objects = $acl["aco"];
    $message = "<?xml version=\"1.0\"?>\n" . "<response>\n" . "\t<inactive>\n";
    foreach ($list_aco_objects as $key => $value) {
        $counter = 0;
        foreach ($list_aco_objects[$key] as $value2) {
            if (!array_key_exists($key, $active_aco_objects) || !in_array($value2, $active_aco_objects[$key])) {
                if ($counter == 0) {
                    $counter = $counter + 1;
                    $aco_section_data = $gacl->get_section_data($key, 'ACO');
                    $aco_section_title = $aco_section_data[3];
                    // Modified 6-2009 by BM - Translate gacl aco section name
                    $message .= "\t\t<section>\n" . "\t\t\t<name>" . xl($aco_section_title) . "</name>\n";
                }
                $aco_id = $gacl->get_object_id($key, $value2, 'ACO');
                $aco_data = $gacl->get_object_data($aco_id, 'ACO');
                $aco_title = $aco_data[0][3];
                $message .= "\t\t\t<aco>\n";
                // Modified 6-2009 by BM - Translate gacl aco name
                $message .= "\t\t\t\t<title>" . xl($aco_title) . "</title>\n";
                $message .= "\t\t\t\t<id>" . $aco_id . "</id>\n";
                $message .= "\t\t\t</aco>\n";
            }
        }
        if ($counter != 0) {
            $message .= "\t\t</section>\n";
        }
    }
    $message .= "\t</inactive>\n" . "\t<active>\n";
    foreach ($active_aco_objects as $key => $value) {
        $aco_section_data = $gacl->get_section_data($key, 'ACO');
        $aco_section_title = $aco_section_data[3];
        // Modified 6-2009 by BM - Translate gacl aco section name
        $message .= "\t\t<section>\n" . "\t\t\t<name>" . xl($aco_section_title) . "</name>\n";
        foreach ($active_aco_objects[$key] as $value2) {
            $aco_id = $gacl->get_object_id($key, $value2, 'ACO');
            $aco_data = $gacl->get_object_data($aco_id, 'ACO');
            $aco_title = $aco_data[0][3];
            $message .= "\t\t\t<aco>\n";
            // Modified 6-2009 by BM - Translate gacl aco name
            $message .= "\t\t\t\t<title>" . xl($aco_title) . "</title>\n";
            $message .= "\t\t\t\t<id>" . $aco_id . "</id>\n";
            $message .= "\t\t\t</aco>\n";
        }
        $message .= "\t\t</section>\n";
    }
    $message .= "\t</active>\n";
    if (isset($err)) {
        foreach ($err as $value) {
            $message .= "\t<error>" . $value . "</error>\n";
        }
    }
    $message .= "</response>\n";
    return $message;
}
// $Id:
include_once OOO_APP_CLASSES . '/user.php';
include_once OOO_APP_CLASSES . '/base_users.php';
include_once OOO_LIB . '/phpgacl/gacl.class.php';
include_once OOO_LIB . '/phpgacl/gacl_api.class.php';
$gacl_api = new gacl_api($gacl_options);
$base_user = new base_users($DB);
$user = new user($DB);
if ($op == 'deleteuser') {
    $arr_id = $_POST['delete'];
    for ($i = 0; $i < count($arr_id); $i++) {
        $user->id = $arr_id[$i];
        $user->deleteuser();
        $base_user->id = $user->id;
        $base_user->deletebase_users();
        $id = $gacl_api->get_object_id('users', $user->id, 'ARO');
        $gacl_api->del_object($id, 'ARO', true);
    }
} else {
    $base_user->username = $_POST['email'];
    $base_user->password = md5($_POST['password']);
    if ($op == 'createuser') {
        $base_user->insertbase_users();
        $id = $base_user->getInsert_ID();
    } elseif ($op == 'updateuser') {
        $id = $_POST['user_id'];
        $base_user->id = $id;
        $base_user->updatebase_users();
    } else {
        $id = $_SESSION["session_User"];
        $base_user->id = $id;