当前位置: 首页>>代码示例>>PHP>>正文


PHP Subnets::check_permission方法代码示例

本文整理汇总了PHP中Subnets::check_permission方法的典型用法代码示例。如果您正苦于以下问题:PHP Subnets::check_permission方法的具体用法?PHP Subnets::check_permission怎么用?PHP Subnets::check_permission使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Subnets的用法示例。


在下文中一共展示了Subnets::check_permission方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _

$Admin = new Admin($Database, false);
$Subnets = new Subnets($Database);
$Addresses = new Addresses($Database);
$Result = new Result();
# verify that user is logged in
$User->check_user_session();
# create csrf token
$csrf = $User->create_csrf_cookie();
# id must be numeric
if (!is_numeric($_POST['subnetId'])) {
    $Result->show("danger", _("Invalid ID"), true, true);
}
# get subnet details
$subnet = $Subnets->fetch_subnet(null, $_POST['subnetId']);
# verify that user has write permissions for subnet
$subnetPerm = $Subnets->check_permission($User->user, $subnet->id);
if ($subnetPerm < 3) {
    $Result->show("danger", _('You do not have permissions to resize subnet') . '!', true, true);
}
?>

<!-- header -->
<div class="pHeader"><?php 
print _('Truncate subnet');
?>
</div>

<!-- content -->
<div class="pContent">
	<table class="table table-noborder table-condensed">
开发者ID:mwodz,项目名称:phpipam,代码行数:30,代码来源:truncate.php

示例2: DNS

    # subnet-related variables
    $subnet = (array) $Subnets->fetch_subnet(null, $_POST['subnetId']);
    //subnet details
    $subnet_detailed = $Subnets->get_network_boundaries($subnet['subnet'], $subnet['mask']);
    //set network boundaries
    $slaves = $Subnets->has_slaves($subnet['id']) ? true : false;
    //check if subnet has slaves and set slaves flag true/false
    # fetch all addresses - sorted
    if ($slaves) {
        $addresses = $Addresses->fetch_subnet_addresses_recursive($subnet['id'], false, $sort['field'], $sort['direction']);
        $slave_subnets = (array) $Subnets->fetch_subnet_slaves($subnet['id']);
    } else {
        $addresses = $Addresses->fetch_subnet_addresses($subnet['id'], $sort['field'], $sort['direction']);
    }
    # set permissions
    $subnet_permission = $Subnets->check_permission($User->user, $subnet['id']);
}
# We need DNS object
$DNS = new DNS($Database, $User->settings);
/* verifications */
# checks
if (sizeof($subnet) == 0) {
    $Result->show("danger", _('Subnet does not exist'), true);
}
//subnet doesnt exist
if ($subnet_permission == 0) {
    $Result->show("danger", _('You do not have permission to access this network'), true);
}
//not allowed to access
if (!is_numeric($_REQUEST['subnetId'])) {
    $Result->show("danger", _('Invalid ID'), true);
开发者ID:rtd,项目名称:phpipam,代码行数:31,代码来源:print-address-table.php

示例3:

$_POST = $User->strip_input_tags($_POST);
# validate action
$Admin->validate_action($_POST['action'], true);
# ID must be numeric
if ($_POST['action'] != "add") {
    if (!is_numeric($_POST['subnetId'])) {
        $Result->show("danger", _("Invalid ID"), true, true);
    }
}
# verify that user has permissions to add subnet
if ($_POST['action'] == "add") {
    if ($Sections->check_permission($User->user, $_POST['sectionId']) != 3) {
        $Result->show("danger", _('You do not have permissions to add new subnet in this section') . "!", true, true);
    }
} else {
    if ($Subnets->check_permission($User->user, $_POST['subnetId']) != 3) {
        $Result->show("danger", _('You do not have permissions to add edit/delete this subnet') . "!", true, true);
    }
}
# we are editing or deleting existing subnet, get old details
if ($_POST['action'] != "add") {
    $folder_old_details = (array) $Subnets->fetch_subnet(null, $_POST['subnetId']);
} else {
    # for selecting master subnet if added from subnet details!
    if (strlen($_POST['subnetId']) > 0) {
        $subnet_old_temp = (array) $Subnets->fetch_subnet(null, $_POST['subnetId']);
        $subnet_old_details['masterSubnetId'] = @$subnet_old_temp['id'];
        // same master subnet ID for nested
        $subnet_old_details['vlanId'] = @$subnet_old_temp['vlanId'];
        // same default vlan for nested
        $subnet_old_details['vrfId'] = @$subnet_old_temp['vrfId'];
开发者ID:routenull0,项目名称:phpipam,代码行数:31,代码来源:edit-folder.php

示例4: foreach

 print "\t<th>" . _('User') . "</th>";
 print "\t<th>" . _('Type') . "</th>";
 print "\t<th>" . _('Object') . "</th>";
 print "\t<th>" . _('Date') . "</th>";
 print "\t<th class='hidden-xs'>" . _('Change') . "</th>";
 print "</tr>";
 # logs
 $pc = 0;
 //print count
 foreach ($clogs as $l) {
     # cast
     $l = (array) $l;
     if ($pc < 5) {
         # permissions
         if ($l['ctype'] == "subnet") {
             $permission = $Subnets->check_permission($User->user, $l['tid']);
         } elseif ($l['ctype'] == "ip_addr") {
             $permission = $Subnets->check_permission($User->user, $l['subnetId']);
         } elseif ($l['ctype'] == "section") {
             $permission = $Sections->check_permission($User->user, $l['sectionId']);
         } else {
             $permission = 0;
         }
         # if 0 ignore
         if ($permission > 0) {
             # format diff
             $changelog = str_replace("\r\n", "<br>", $l['cdiff']);
             $changelog = str_replace("\n", "<br>", $changelog);
             $changelog = array_filter(explode("<br>", $changelog));
             $diff = array();
             foreach ($changelog as $c) {
开发者ID:routenull0,项目名称:phpipam,代码行数:31,代码来源:changelog.php

示例5: sizeof

}
# generate firewall address object name
$firewallZoneSettings = json_decode($User->settings->firewallZoneSettings, true);
if ($firewallZoneSettings->autogen == 'on') {
    if ($address['action'] == 'add') {
        $address['firewallAddressObject'] = $Zones->generate_address_object($address['subnetId'], $address['dns_name']);
    } else {
        if ($_POST['firewallAddressObject']) {
            $address['firewallAddressObject'] = $_POST['firewallAddressObject'];
        } else {
            $address['firewallAddressObject'] = NULL;
        }
    }
}
# set and check permissions
$subnet_permission = $Subnets->check_permission($User->user, $address['subnetId']);
$subnet_permission > 1 ?: $Result->show("danger", _('Cannot edit IP address'), true);
# fetch subnet
$subnet = (array) $Subnets->fetch_subnet(null, $address['subnetId']);
if (@$_POST['verifydatabase'] !== "yes") {
    sizeof($subnet) > 0 ?: $Result->show("danger", _("Invalid subnet"), true);
}
# replace empty fields with nulls
$address = $Addresses->reformat_empty_array_fields($address, null);
# custom fields and checks
$custom_fields = $Tools->fetch_custom_fields('ipaddresses');
if (sizeof($custom_fields) > 0) {
    foreach ($custom_fields as $field) {
        # replace possible ___ back to spaces!
        $field['nameTest'] = str_replace(" ", "___", $field['name']);
        if (isset($address[$field['nameTest']])) {
开发者ID:routenull0,项目名称:phpipam,代码行数:31,代码来源:address-modify-submit.php

示例6: _

#is_numeric($_POST['subnetId']) ?:                                                       $Result->show("danger", _("Invalid ID"), true, true, false, true);
#if(is_numeric($id)) {
#        strlen($id)!=0 ?:                                                              $Result->show("danger", _("Invalid ID"), true, true, false, true);
# fetch address
#        $address = (array) $Addresses->fetch_address(null, $id);
#}
// from adding new IP, validate
#else {
#        $validate = $Subnets->identify_address ($_POST['id'])=="IPv4" ? filter_var($_POST['id'], FILTER_VALIDATE_IP) : filter_var($_POST['id'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV6);
#        if ($validate===false)                                                                  { $Result->show("danger", _("Invalid IP address"), true, true, false, true); }
#        else {
#                $address['ip'] = $id;
#        }
#}
# set and check permissions
$subnet_permission = $Subnets->check_permission($User->user, $_POST['subnetId']);
$subnet_permission > 2 ?: $Result->show("danger", _('Cannot edit IP address details') . '! <br>' . _('You do not have write access for this network'), true, true);
?>

<!-- header -->
<div class="pHeader"><?php 
print _('Show Individual IP Info');
?>
</div>

<!-- content -->
<div class="pContent">
	<?php 
print "<table class='ipaddress_subnet table table-noborder table-condensed' style='margin-top:10px;'>";
print "<tr>";
print "\t<th>" . _('Hostname') . "</th>";
开发者ID:itdependsnetworks,项目名称:phpipam,代码行数:31,代码来源:info-address.php

示例7: foreach

            }
        }
        ?>
	<th style="width:5px;"></th>
</tr>
<?php 
        $m = 0;
        //to count success subnets because of permissions
        /** subnet results **/
        if (sizeof($result_subnets) > 0) {
            # loop
            foreach ($result_subnets as $line) {
                # cast
                $line = (array) $line;
                # check permission
                $subnet_permission = $Subnets->check_permission($User->user, $line['id']);
                if ($subnet_permission > 0) {
                    $m++;
                    //get section details
                    $section = (array) $Sections->fetch_section(null, $line['sectionId']);
                    //get vlan number
                    $vlan = (array) $Tools->fetch_object("vlans", "vlanId", $line['vlanId']);
                    //format requests
                    $line['allowRequests'] = $line['allowRequests'] == 1 ? "enabled" : "disabled";
                    //format master subnet
                    if ($line['masterSubnetId'] == 0) {
                        $master_text = "/";
                    } else {
                        $master_subnet = (array) $Subnets->fetch_subnet(null, $line['masterSubnetId']);
                        # folder?
                        if ($master_subnet['isFolder'] == 1) {
开发者ID:dajo,项目名称:phpipam,代码行数:31,代码来源:search-results.php

示例8: ip_request_get_mail_recipients

 /**
  * Returns list of recipients to get new
  *
  * @access private
  * @param bool|mixed $subnetId
  * @return array|bool
  */
 private function ip_request_get_mail_recipients($subnetId = false)
 {
     // fetch all users with mailNotify
     $notification_users = $this->fetch_multiple_objects("users", "mailNotify", "Yes", "id", true);
     // recipients array
     $recipients = array();
     // any ?
     if ($notification_users !== false) {
         // if subnetId is set check who has permissions
         if (isset($subnetId)) {
             foreach ($notification_users as $u) {
                 // inti object
                 $Subnets = new Subnets($this->Database);
                 //check permissions
                 $subnet_permission = $Subnets->check_permission($u, $subnetId);
                 // if 3 than add
                 if ($subnet_permission == 3) {
                     $recipients[] = $u;
                 }
             }
         } else {
             foreach ($notification_users as $u) {
                 if ($u->role == "Administrator") {
                     $recipients[] = $u;
                 }
             }
         }
         return sizeof($recipients) > 0 ? $recipients : false;
     } else {
         return false;
     }
 }
开发者ID:routenull0,项目名称:phpipam,代码行数:39,代码来源:class.Tools.php

示例9: Addresses

$Addresses = new Addresses($Database);
$Subnets = new Subnets($Database);
$Tools = new Tools($Database);
$Result = new Result();
# verify that user is logged in
$User->check_user_session();
# fetch request
$request = $Admin->fetch_object("requests", "id", $_POST['requestId']);
//fail
if ($request === false) {
    $Result->show("danger", _("Request does not exist"), true, true);
} else {
    $request = (array) $request;
}
# verify permissions
if ($Subnets->check_permission($User->user, $request['subnetId']) != 3) {
    $Result->show("danger", _('You do not have permissions to process this request') . "!", true, true);
}
# set IP address
# if provided (requested from logged in user) check if already in use, if it is warn and set next free
# else get next free
if (strlen($request['ip_addr']) > 0) {
    // check if it exists
    if ($Addresses->address_exists($request['ip_addr'], $request['subnetId'])) {
        $errmsg = "Requested IP address ({$request['ip_addr']}) already used. First available address automatically provided.";
        $errmsg_class = "warning";
        //fetch first free
        $ip_address = $Addresses->transform_to_dotted($Addresses->get_first_available_address($request['subnetId'], $Subnets));
    } else {
        $ip_address = $request['ip_addr'];
    }
开发者ID:martinsv,项目名称:phpipam,代码行数:31,代码来源:edit.php

示例10: foreach

    $height = 350;
    $slimit = 5;
    # and print title
    print "<div class='container'>";
    print "<h4 style='margin-top:40px;'>{$widget->wtitle}</h4><hr>";
    print "</div>";
}
if ($User->settings->enableThreshold == "1") {
    # get thresholded subnets
    $threshold_subnets = $Subnets->fetch_threshold_subnets(1000);
    # any found ?
    if ($threshold_subnets !== false) {
        # loop
        foreach ($threshold_subnets as $s) {
            # check permission of user
            $sp = $Subnets->check_permission($User->user, $s->id);
            if ($sp != "0") {
                $out[] = $s;
            }
        }
    }
}
# disabled
if ($User->settings->enableThreshold != "1") {
    print "<hr>";
    print "<blockquote style='margin-top:20px;margin-left:20px;'>";
    print "<p>" . _("Threshold module disabled") . "</p>";
    print "<small>" . _("You can enable threshold module under settings") . "</small>";
    print "</blockquote>";
} elseif ($threshold_subnets === false) {
    print "<hr>";
开发者ID:routenull0,项目名称:phpipam,代码行数:31,代码来源:threshold.php


注:本文中的Subnets::check_permission方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。