本文整理汇总了PHP中Acl::entityAllowed方法的典型用法代码示例。如果您正苦于以下问题:PHP Acl::entityAllowed方法的具体用法?PHP Acl::entityAllowed怎么用?PHP Acl::entityAllowed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Acl
的用法示例。
在下文中一共展示了Acl::entityAllowed方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: REQUEST
return $summary;
}
/****************************************************
******************** Import data *******************
****************************************************/
$import_type = REQUEST('import_type');
$import_type = empty($import_type) ? 'networks' : $import_type;
if ($_POST['import_assets'] == 1) {
$data['status'] = 'error';
$data['data'] = NULL;
$file_csv = $_SESSION['file_csv'];
unset($_SESSION['file_csv']);
$iic = POST('iic');
$ctx = POST('ctx');
if (Session::is_pro()) {
if (!valid_hex32($ctx) || Acl::entityAllowed($ctx) < 1) {
$data['data'] = empty($ctx) ? _('You must select an entity') : _('Entity not allowed');
echo json_encode($data);
exit;
}
} else {
$ctx = Session::get_default_ctx();
}
if (!empty($file_csv)) {
$data['status'] = 'OK';
$data['data'] = import_assets_from_csv($file_csv, $_POST['iic'], $ctx, $import_type);
//@unlink($file_csv);
} else {
$data['data'] = _('Failed to read data from CSV file. File is missing');
}
echo json_encode($data);
示例2: _
$recent_pass = Log_action::get_last_pass($conn, $login);
if ($pass_expire_min > 0 && dateDiff_min($last_pass_change, date('Y-m-d H:i:s')) < $pass_expire_min && !Session::am_i_admin()) {
$validation_errors['pass'] = _('Password lifetime is too short to allow change. Wait a few minutes...');
} elseif (count($recent_pass) > 0 && (in_array(md5($pass1), $recent_pass) || in_array(hash('sha256', $pass1), $recent_pass))) {
$validation_errors['pass'] = _('This password is recently used. Try another');
}
}
}
}
}
//Checking entities field requirements
if (empty($validation_errors['entities[]'])) {
//Check allowed entities
if ($pro && !$is_my_profile) {
foreach ($entities as $ent_id) {
if (!Acl::entityAllowed($ent_id)) {
$validation_errors['entities[]'] = _("You don't have permission to create users at this level");
break;
}
}
}
}
if (is_array($validation_errors) && !empty($validation_errors)) {
$data['status'] = 'error';
$data['data'] = $validation_errors;
} else {
$data['status'] = 'OK';
$data['data'] = $validation_errors;
}
if (POST('ajax_validation_all') == TRUE) {
echo json_encode($data);
示例3: ossim_valid
ossim_valid($engine_id, OSS_HEX, '\\-', OSS_NULLABLE, 'illegal:' . _("Engine ID"));
ossim_valid($toggled_dir, OSS_DIGIT, OSS_NULLABLE, 'illegal:' . _("Directive ID"));
ossim_valid($toggled_info, OSS_DIGIT, OSS_NULLABLE, 'illegal:' . _("Directive Option"));
if (ossim_error()) {
die(ossim_error());
}
if (GET('msg_success') == 1) {
$msg_success = _("Directive successfully saved");
}
$conf = $GLOBALS["CONF"];
if ($engine_id == "") {
$engine_id = $conf->get_conf("default_engine_id", false);
}
$found = 0;
// Default engine is not allowed by CTX user perms
if (Session::get_ctx_where() != "" && Session::is_pro() && !Acl::entityAllowed(strtoupper(str_replace("-", "", $engine_id)))) {
if ($_SESSION['_user_vision']['ctx'] != "") {
$engine_id = Util::uuid_format($_SESSION['_user_vision']['ctx']);
}
}
$directive_editor = new Directive_editor($engine_id);
// Default toggle User Contributed
if ($toggled == "") {
$toggled = "user.xml";
}
if (POST('delete_directive_id') != "") {
$toggled = POST('file');
ossim_valid(POST('delete_directive_id'), OSS_DIGIT, 'illegal:' . _("Directive ID"));
ossim_valid(POST('file'), OSS_ALPHA, OSS_PUNC, 'illegal:' . _("File"));
if (ossim_error()) {
die(ossim_error());
示例4: echochildrens
function echochildrens($entities, $parent_id, $entities_admin)
{
/* Connect to db */
$db = new ossim_db();
$conn = $db->connect();
$users_by_entity = Acl::get_users_by_entity($conn, $parent_id);
$me = Session::get_session_user();
$entities_types = Acl::get_entities_types($conn);
$length_name = !empty($_GET['length_name']) ? GET('length_name') : 30;
echo ",children:[";
$is_editable = $parent_id != "" && (!empty($users_by_entity[$me]) || Session::am_i_admin() || !empty($entities_admin[$me]));
if ($is_editable) {
echo "{title:'<font style=\"font-weight:normal\">" . _("All Assets") . "</font>', url:'AllAssets', key:'e_" . $parent_id . "_allassets', icon:'../../pixmaps/menu/assets.gif', isFolder:false, expand:true,";
echo "children:[ ";
echo "{ key:'e_" . $parent_id . "_net', isFolder:true, isLazy:true, icon:'../../pixmaps/theme/net.png', title:'" . _("Networks") . "'},";
echo "{ key:'e_" . $parent_id . "_sensor', isFolder:true, isLazy:true, icon:'../../pixmaps/theme/server.png', title:'" . _("Sensors") . "'}";
echo "]}";
}
$children = Acl::get_entity_childs($conn, $parent_id);
if (!empty($children)) {
$flag = false;
foreach ($children as $index => $child_id) {
$icon = "../../pixmaps/theme/any.png";
$child = $entities[0][$child_id];
$entity_allowed = Acl::entityAllowed($child_id);
$child_key = "e_" . $child_id;
$child_sn = strlen($child['name']) > $length_name ? substr($child['name'], 0, $length_name) . "..." : $child['name'];
$child_name = Util::htmlentities($child['name']);
$chil_ent_admin = $entities_admin;
$chil_ent_admin[$child['admin_user']] = $child_id;
if ($child['parent_id'] == $parent_id) {
$title = "<font style=\"font-weight:bold;\">" . Util::htmlentities($child_sn) . "</font> <font style=\"color:gray\">[" . $entities_types[$child['type']]['name'] . "]</font>";
$tooltip = Util::htmlentities($child['name']) . " [" . $entities_types[$child['type']]['name'] . "]";
if ($flag || $is_editable) {
echo ",";
}
$flag = true;
echo "{title:'" . $title . "', tooltip:'{$tooltip}', noLink: true, url:'" . $child_url . "', key:'" . $child_key . "', icon:'{$icon}', expand:true, name:'{$child_name}'";
echochildrens($entities, $child_id, $withusers, $entities_admin, $length_name);
echo "}";
}
}
}
echo "]";
}
示例5: echochildrens
function echochildrens($entities, $parent_id, $withusers, $entities_admin)
{
$length_name = 50;
echo ",children:[";
/* Connect to db */
$db = new ossim_db();
$conn = $db->connect();
$users_by_entity = Acl::get_users_by_entity($conn, $parent_id);
$me = Session::get_session_user();
$entities_types = Acl::get_entities_types($conn);
$is_editable = $parent_id != "" && (!empty($users_by_entity[$me]) || Session::am_i_admin() || !empty($entities_admin[$me]));
if ($is_editable) {
echo "{title:'<font style=\"font-weight:normal\">" . _("All Assets") . "</font>', key:'ae_" . $parent_id . "', icon:'../../pixmaps/menu/assets.gif', isFolder:true, isLazy:true}";
if ($withusers) {
echo ",{title:'<font style=\"font-weight:normal\">" . _("Assets by user") . "</font>', key:'ue_" . $parent_id . "', icon:'../../pixmaps/menu/assets.gif', isFolder:true, isLazy:true}";
}
}
$children = Acl::get_entity_childs($conn, $parent_id);
if (!empty($children)) {
$flag = false;
foreach ($children as $index => $child_id) {
$icon = "../../pixmaps/theme/any.png";
$child = $entities[0][$child_id];
$entity_allowed = Acl::entityAllowed($child_id);
if ($entity_allowed == 2) {
$child_link = "noLink: false";
$child_url = "../acl/entities_edit.php?id=" . $child_id;
} else {
$child_link = "noLink: true";
$child_url = "";
}
$child_key = "e_" . $child_id;
$child_sn = strlen($child['name']) > $length_name ? substr($child['name'], 0, $length_name) . "..." : $child['name'];
$child_name = Util::htmlentities($child['name']);
$chil_ent_admin = $entities_admin;
$chil_ent_admin[$child['admin_user']] = $child_id;
if ($child['parent_id'] == $parent_id) {
$title = "<font style=\"font-weight:bold;\">" . Util::htmlentities($child_sn) . "</font> <font style=\"color:gray\">[" . $entities_types[$child['type']]['name'] . "]</font>";
$tooltip = Util::htmlentities($child['name']) . " [" . $entities_types[$child['type']]['name'] . "]";
if ($flag || $is_editable) {
echo ",";
}
$flag = true;
$h = "400";
echo "{title:'" . $title . "', h:'{$h}', " . $child_link . ", url:'" . $child_url . "', tooltip:'{$tooltip}', key:'" . $child_key . "', icon:'{$icon}', expand:true, name:'{$child_name}'";
echochildrens($entities, $child_id, $withusers, $entities_admin);
echo "}";
}
}
}
echo "]";
}