예제 #1
0
    } else {
        ?>
	                <td><input type="checkbox" name="reminder[<?php 
        echo $index;
        ?>
]]"></td>
				<?php 
    }
    ?>
               
                 <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';
            }
예제 #2
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;
}
예제 #3
0
// +---------------------------------------------------------------------------+
// | This file is part of the Openology FrameWork                              |
// | Copyright (c) 2004-2005 Openology.org Team                                |
// |                                                                           |
// | For the full copyright and license information, please view the COPYRIGHT |
// | file that was distributed with this source code. If the COPYRIGHT file is |
// | missing, please visit Openology homepage: http://www.openology.org/       |
// +---------------------------------------------------------------------------+
//
// $Id:
include_once OOO_APP_MODULES . '/page.php';
include_once OOO_APP_CLASSES . '/usergroup.php';
include_once OOO_CORE . '/form/Form.php';
include_once OOO_CORE . '/form/FormController.php';
$gacl_api = new gacl_api($gacl_options);
$arr_data = $gacl_api->get_objects('', 1, 'aco');
$arr_aco = array();
$arr_tmp = $arr_data['system'];
for ($i = 0; $i < count($arr_tmp); $i++) {
    $arr_aco[$arr_tmp[$i]] = $arr_tmp[$i];
}
//print_r($arr_aco);
$form = new Form('form1', 'index.php', 'post');
$text1 =& $form->addElement('text');
$text1->setAttribute('id', 'name');
$text2 =& $form->addElement('textarea');
$text2->setAttribute('id', 'description');
$text3 =& $form->addElement('checkbox');
$text3->setAttribute('id', 'permission');
$text3->setAttribute('name', 'permission[]');
$text3->setAttribute('checkboxes', $arr_aco);
예제 #4
0
 public function act_permissions()
 {
     global $global;
     include_once APPROOT . '3rd/phpgacl/gacl_api.class.php';
     $gacl = new gacl_api(array('db' => $global['db'], 'db_table_prefix' => 'gacl_'));
     //select role
     $this->roles = acl_get_roles();
     if (isset($_REQUEST['role'])) {
         $this->role = $_REQUEST['role'];
     }
     //change role if requested
     if (isset($_POST['change_role'])) {
         $this->role = $_POST['role'];
     }
     if (!array_key_exists($this->role, $this->roles)) {
         $this->role = key($this->roles);
     }
     $role_id = $gacl->get_group_id($this->role, NULL, 'ARO');
     $role_name = $gacl->get_group_data($role_id, 'ARO');
     $role_name = $role_name[3];
     //list accessible modules
     $options = $gacl->get_objects('crud', 0, 'ACO');
     $this->crud = $options['crud'];
     $group_id = $gacl->get_group_id('entities', 'Entities', 'AXO');
     $entity_groups = $gacl->get_group_children($group_id, 'AXO', 'NO_RECURSE');
     $this->entity_groups = array();
     foreach ($entity_groups as $id) {
         $group = $gacl->get_group_data($id, 'AXO');
         $this->entity_groups[$group[2]] = _t($group[3]);
     }
     //get the deny list
     $acl_list = array();
     $this->select = array();
     foreach ($this->entity_groups as $key => $group) {
         $acl_id = $gacl->search_acl('crud', FALSE, FALSE, FALSE, $role_name, FALSE, FALSE, $group, FALSE);
         if ($acl_id) {
             $acl_list = array_merge($acl_list, $acl_id);
         }
         $acl = $gacl->get_acl($acl_id[0]);
         if ($acl['allow'] == 0) {
             $crud = $acl['aco']['crud'];
         }
         foreach ($this->crud as $opt) {
             $this->select[$key . "_" . $opt] = true;
             if (is_array($crud) && in_array($opt, $crud)) {
                 $this->select[$key . "_" . $opt] = false;
             }
         }
     }
     //list accessible entities
     if ($_POST['change_permissions']) {
         if ($this->role == 'admin') {
             shnMessageQueue::addInformation(_t('YOU_CANNOT_CHANGE_THE_ADMINISTRATOR_PERMISSIONS_'));
         } else {
             $this->select = array();
             foreach ($this->entity_groups as $key => $group) {
                 $crud = array();
                 foreach ($this->crud as $opt) {
                     if (!isset($_POST[$key . '_' . $opt])) {
                         array_push($crud, $opt);
                     }
                     $this->select[$key . "_" . $opt] = true;
                     if (is_array($crud) && in_array($opt, $crud)) {
                         $this->select[$key . "_" . $opt] = false;
                     }
                 }
                 $axo_id = $gacl->get_group_id($key, $group, 'AXO');
                 if (count($crud) > 0) {
                     $gacl->add_acl(array('crud' => $crud), NULL, array($role_id), NULL, array($axo_id), 0, 1);
                 }
             }
             //delete previous acls
             foreach ($acl_list as $acl_id) {
                 $gacl->del_acl($acl_id);
             }
         }
     }
 }