本文整理汇总了PHP中Security::hasAnyPermission方法的典型用法代码示例。如果您正苦于以下问题:PHP Security::hasAnyPermission方法的具体用法?PHP Security::hasAnyPermission怎么用?PHP Security::hasAnyPermission使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Security
的用法示例。
在下文中一共展示了Security::hasAnyPermission方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: hookMenu
/** Menu hook function */
public static function hookMenu()
{
$items = array();
$server = Server::getServer();
if (Security::hasAnyPermission(array(array(Permission::P('SERVER_PERM_EDIT_CONTENT_LIBRARY'), $server)))) {
$items[] = array('path' => 'server/content_library', 'title' => _("Reusable content library"), 'url' => BASE_URL_PATH . htmlspecialchars("admin/generic_object_admin.php?object_class=Content&action=list"));
}
return $items;
}
示例2: processAdminUI
/**
* Process admin interface of this object.
*
* @return void
*
* @access public
*/
public function processAdminUI()
{
Security::requirePermission(Permission::P('NETWORK_PERM_EDIT_NETWORK_CONFIG'), $this);
// Content management
parent::processContentAdminUI();
// name
$name = "network_" . $this->getId() . "_name";
$this->setName($_REQUEST[$name]);
// creation_date
$name = "network_" . $this->getId() . "_creation_date";
$this->setCreationDate($_REQUEST[$name]);
// homepage_url
$name = "network_" . $this->getId() . "_homepage_url";
$this->setWebSiteUrl($_REQUEST[$name]);
// tech_support_email
$name = "network_" . $this->getId() . "_tech_support_email";
$this->setTechSupportEmail($_REQUEST[$name]);
// network_authenticator_class
$name = "network_" . $this->getId() . "_network_authenticator_class";
$this->setAuthenticatorClassName($_REQUEST[$name]);
// network_authenticator_params
$name = "network_" . $this->getId() . "_network_authenticator_params";
$this->setAuthenticatorConstructorParams($_REQUEST[$name]);
// is_default_network
$name = "network_" . $this->getId() . "_is_default_network";
if (!empty($_REQUEST[$name]) && $_REQUEST[$name] == 'on') {
$this->setAsDefaultNetwork();
}
// validation_grace_time
$name = "network_" . $this->getId() . "_validation_grace_time";
$this->setValidationGraceTime($_REQUEST[$name]);
// validation_email_from_address
$name = "network_" . $this->getId() . "_validation_email_from_address";
$this->setValidationEmailFromAddress($_REQUEST[$name]);
$name = "network_" . $this->getId() . "_usernames_case_sensitive";
$this->setUsernamesCaseSensitive(empty($_REQUEST[$name]) ? false : true);
// theme_pack
$name = "network_" . $this->getId() . "_theme_pack";
if (!empty($_REQUEST[$name])) {
$theme_pack = ThemePack::getObject($_REQUEST[$name]);
} else {
$theme_pack = null;
}
$this->setThemePack($theme_pack);
// allow_multiple_login
$name = "network_" . $this->getId() . "_allow_multiple_login";
$this->setMultipleLoginAllowed(empty($_REQUEST[$name]) ? false : true);
// allow_splash_only_nodes
$name = "network_" . $this->getId() . "_allow_splash_only_nodes";
$this->setSplashOnlyNodesAllowed(empty($_REQUEST[$name]) ? false : true);
// allow_custom_portal_redirect
$name = "network_" . $this->getId() . "_allow_custom_portal_redirect";
$this->setCustomPortalRedirectAllowed(empty($_REQUEST[$name]) ? false : true);
// 'allow_original_URL_redirect
$name = "network_" . $this->getId() . "_allow_original_URL_redirect";
$this->setPortalOriginalUrlAllowed(empty($_REQUEST[$name]) ? false : true);
/*
* Dynamic abuse control
*/
$html_dynamic_abuse_control = array();
$permArray = null;
$permArray[] = array(Permission::P('NETWORK_PERM_EDIT_DYNAMIC_ABUSE_CONTROL'), $this);
if (Security::hasAnyPermission($permArray)) {
// connection_limit_window
$name = "network_" . $this->getId() . "_connection_limit_window";
$this->setConnectionLimitWindow($_REQUEST[$name]);
// connection_limit_network_max_total_bytes
$name = "network_" . $this->getId() . "_connection_limit_network_max_total_bytes";
$this->setConnectionLimitNetworkMaxTotalBytes($_REQUEST[$name]);
// connection_limit_network_max_usage_duration
$name = "network_" . $this->getId() . "_connection_limit_network_max_usage_duration";
$this->setConnectionLimitNetworkMaxDuration($_REQUEST[$name]);
// connection_limit_node_max_total_bytes
$name = "network_" . $this->getId() . "_connection_limit_node_max_total_bytes";
$this->setConnectionLimitNodeMaxTotalBytes($_REQUEST[$name]);
// connection_limit_node_max_usage_duration
$name = "network_" . $this->getId() . "_connection_limit_node_max_usage_duration";
$this->setConnectionLimitNodeMaxDuration($_REQUEST[$name]);
}
// Access rights
require_once 'classes/Stakeholder.php';
Stakeholder::processAssignStakeholdersUI($this, $errMsg);
if (!empty($errMsg)) {
echo $errMsg;
}
// GIS data
if (defined('GMAPS_HOTSPOTS_MAP_ENABLED') && GMAPS_HOTSPOTS_MAP_ENABLED == true) {
$gis_lat_name = "network_" . $this->getId() . "_gis_latitude";
$gis_long_name = "network_" . $this->getId() . "_gis_longitude";
$gis_alt_name = "network_" . $this->getId() . "_gis_altitude";
$this->setGisLocation(new GisPoint($_REQUEST[$gis_lat_name], $_REQUEST[$gis_long_name], $_REQUEST[$gis_alt_name]));
$name = "network_" . $this->getId() . "_gmaps_map_type";
$this->setGisMapType($_REQUEST[$name]);
//.........这里部分代码省略.........
示例3: processAdminUI
/**
* Process admin interface of this object.
*
* @return void
*
* @access public
*/
public function processAdminUI()
{
require_once 'classes/Stakeholder.php';
$user = User::getCurrentUser();
// Get information about the network
$network = $this->getNetwork();
//pretty_print_r($_REQUEST);
$permArray[] = array(Permission::P('NETWORK_PERM_EDIT_ANY_NODE_CONFIG'), $this->getNetwork());
$permArray[] = array(Permission::P('NODE_PERM_EDIT_CONFIG'), $this);
$permArray[] = array(Permission::P('NODE_PERM_EDIT_GATEWAY_ID'), $this);
$permArray[] = array(Permission::P('NODE_PERM_EDIT_DEPLOYMENT_DATE'), $this);
Security::requireAnyPermission($permArray);
// Check if user is a admin
$_userIsAdmin = User::getCurrentUser()->DEPRECATEDisSuperAdmin();
// Information about the node
$node_id = $this->getId();
// Gateway Id
$permArray = null;
$permArray[] = array(Permission::P('NETWORK_PERM_EDIT_ANY_NODE_CONFIG'), $network);
$permArray[] = array(Permission::P('NODE_PERM_EDIT_GATEWAY_ID'), $this);
if (Security::hasAnyPermission($permArray)) {
$name = "node_" . $node_id . "_gw_id";
$this->setGatewayId($_REQUEST[$name]);
}
// Content processing
parent::processContentAdminUI();
// Name
$permArray = null;
$permArray[] = array(Permission::P('NETWORK_PERM_EDIT_ANY_NODE_CONFIG'), $network);
$permArray[] = array(Permission::P('NODE_PERM_EDIT_NAME'), $this);
if (Security::hasAnyPermission($permArray)) {
$name = "node_" . $node_id . "_name";
$this->setName($_REQUEST[$name]);
}
// Creation date
$permArray = null;
$permArray[] = array(Permission::P('NETWORK_PERM_EDIT_ANY_NODE_CONFIG'), $network);
$permArray[] = array(Permission::P('NODE_PERM_EDIT_DEPLOYMENT_DATE'), $this);
if (Security::hasAnyPermission($permArray)) {
$name = "node_" . $node_id . "_creation_date";
$this->setCreationDate(DateTimeWD::processSelectDateTimeUI($name, DateTimeWD::INTERFACE_DATETIME_FIELD)->getIso8601FormattedString());
}
// Homepage URL
$name = "node_" . $node_id . "_homepage_url";
$this->setWebSiteUrl($_REQUEST[$name]);
// Description
$name = "node_" . $node_id . "_description";
$this->setDescription($_REQUEST[$name]);
// Map URL
$name = "node_" . $node_id . "_map_url";
$this->setMapUrl($_REQUEST[$name]);
// Civic number
$name = "node_" . $node_id . "_civic_number";
$this->setCivicNumber($_REQUEST[$name]);
// Street name
$name = "node_" . $node_id . "_street_name";
$this->setStreetName($_REQUEST[$name]);
// City
$name = "node_" . $node_id . "_city";
$this->setCity($_REQUEST[$name]);
// Province
$name = "node_" . $node_id . "_province";
$this->setProvince($_REQUEST[$name]);
// Postal Code
$name = "node_" . $node_id . "_postal_code";
$this->setPostalCode($_REQUEST[$name]);
// Country
$name = "node_" . $node_id . "_country";
$this->setCountry($_REQUEST[$name]);
// Public phone #
$name = "node_" . $node_id . "_public_phone";
$this->setTelephone($_REQUEST[$name]);
// Public mail
$name = "node_" . $node_id . "_public_email";
$this->setEmail($_REQUEST[$name]);
// Mass transit info
$name = "node_" . $node_id . "_mass_transit_info";
$this->setTransitInfo($_REQUEST[$name]);
// GIS data
// Get a geocoder for a given country
if (!empty($_REQUEST['geocode_only'])) {
if ($geocoder = AbstractGeocoder::getGeocoder($this->getCountry()) != null) {
$geocoder = AbstractGeocoder::getGeocoder($this->getCountry());
} else {
$geocoder = AbstractGeocoder::getGeocoder('Earth');
}
if ($geocoder != null) {
$geocoder->setCivicNumber($this->getCivicNumber());
$geocoder->setStreetName($this->getStreetName());
$geocoder->setCity($this->getCity());
$geocoder->setProvince($this->getProvince());
$geocoder->setPostalCode($this->getPostalCode());
if ($geocoder->validateAddress() == true) {
//.........这里部分代码省略.........
示例4: hookMenu
/** Menu hook function */
public static function hookMenu()
{
$items = array();
$network = Network::getCurrentNetwork();
$server = Server::getServer();
if (Security::hasAnyPermission(array(array(Permission::P('NETWORK_PERM_VIEW_ONLINE_USERS'), $network)))) {
$items[] = array('path' => 'users/online_users', 'title' => _("Online Users"), 'url' => BASE_URL_PATH . "admin/online_users.php");
}
if (Security::hasPermission(Permission::P('SERVER_PERM_EDIT_SERVER_CONFIG'), $server)) {
$items[] = array('path' => 'users/import_nocat', 'title' => _("Import NoCat user database"), 'url' => BASE_URL_PATH . "admin/import_user_database.php");
}
if (Security::getObjectsWithPermission(Permission::P('NETWORK_PERM_EDIT_ANY_USER'))) {
$items[] = array('path' => 'users/user_manager', 'title' => _("User manager"), 'url' => BASE_URL_PATH . "admin/user_log.php");
}
if (Security::getObjectsWithPermission(Permission::P('NETWORK_PERM_VIEW_STATISTICS'))) {
$items[] = array('path' => 'users/statistics', 'title' => _("Statistics"), 'url' => BASE_URL_PATH . "admin/stats.php");
}
$items[] = array('path' => 'users', 'title' => _('User administration'), 'type' => MENU_ITEM_GROUPING);
return $items;
}
示例5: processAdminUI
/**
* Process admin interface of this object.
*
* @return void
*
* @access public
*/
public function processAdminUI()
{
require_once 'classes/Stakeholder.php';
$user = User::getCurrentUser();
// Get information about the network
$network = Network::getDefaultNetwork();
//pretty_print_r($_REQUEST);
$permArray[] = array(Permission::P('NETWORK_PERM_EDIT_ANY_NODEGROUP_CONFIG'), Network::getDefaultNetwork());
$permArray[] = array(Permission::P('NODEGROUP_PERM_EDIT_ANY_NODEGROUP_CONFIG'), $this);
$permArray[] = array(Permission::P('NODEGROUP_PERM_EDIT_NODEGROUP_CONFIG'), $this);
Security::requireAnyPermission($permArray);
// Check if user is a admin
$_userIsAdmin = User::getCurrentUser()->DEPRECATEDisSuperAdmin();
// Information about the node
$ng_id = $this->getId();
// Content processing
parent::processContentAdminUI();
// Name
$permArray = null;
$permArray[] = array(Permission::P('NETWORK_PERM_EDIT_ANY_NODEGROUP_CONFIG'), Network::getDefaultNetwork());
$permArray[] = array(Permission::P('NODEGROUP_PERM_EDIT_NODEGROUP_CONFIG'), $this);
if (Security::hasAnyPermission($permArray)) {
$name = "node_group_" . $ng_id . "_name";
$this->setName($_REQUEST[$name]);
}
// Creation date
$name = "node_group_" . $ng_id . "_creation_date";
$this->setCreationDate(DateTimeWD::processSelectDateTimeUI($name, DateTimeWD::INTERFACE_DATETIME_FIELD)->getIso8601FormattedString());
// Description
$name = "node_" . $ng_id . "_description";
$this->setDescription($_REQUEST[$name]);
parent::processGraphAdminUI($errMsg);
if (!empty($errMsg)) {
echo $errMsg;
$errMsg = null;
}
// End Node group configuration section
// Access rights
Stakeholder::processAssignStakeholdersUI($this, $errMsg);
if (!empty($errMsg)) {
echo $errMsg;
}
}