Beispiel #1
0
        $entity = new $entity_name();
        $table_names[] = $entity->data_table;
    }
    $ops = $table_names;
    asort($ops);
    foreach ($ops as $v) {
        $table_name_options[$v] = $v;
    }
    $TPL["tableNameOptions"] = page::select_options($table_name_options, $permission->get_value("tableName"));
    include_template("templates/permissionTableM.tpl");
    exit;
}
if ($_POST["save"]) {
    $permission->set_value("actions", $actions);
    $permission->set_value("comment", rtrim($permission->get_value("comment")));
    $permission->save();
    alloc_redirect($TPL["url_alloc_permissionList"]);
} else {
    if ($_POST["delete"]) {
        $permission->delete();
        alloc_redirect($TPL["url_alloc_permissionList"]);
    }
}
// necessary
$permission->select();
$TPL["roleNameOptions"] = page::select_options(permission::get_roles(), $permission->get_value("roleName"));
$table_name = $_POST["tableName"] or $table_name = $permission->get_value("tableName");
$entity = new $table_name();
foreach ($entity->permissions as $value => $label) {
    if (($permission->get_value("actions") & $value) == $value) {
        $sel[] = $value;
 public static function update_permissions($changes = array(), $profile_id = 0, $user_id = 0)
 {
     if (!is_array($changes)) {
         return;
     }
     foreach ($changes as $key => $value) {
         $key = str_replace(array('[', ']'), '', $key);
         $ws = null;
         if (strpos($key, "wid") === 0) {
             list($ws, $key) = explode('.', $key, 2);
             $ws = str_replace("wid", "", $ws);
         }
         $permission = new permission();
         $permission->load($key, intval($profile_id), intval($user_id), $ws);
         $permission->value = $value;
         $permission->save();
     }
 }