本文整理汇总了PHP中Session::haveRight方法的典型用法代码示例。如果您正苦于以下问题:PHP Session::haveRight方法的具体用法?PHP Session::haveRight怎么用?PHP Session::haveRight使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Session
的用法示例。
在下文中一共展示了Session::haveRight方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: plugin_init_databases
function plugin_init_databases()
{
global $PLUGIN_HOOKS;
$PLUGIN_HOOKS['csrf_compliant']['databases'] = true;
$PLUGIN_HOOKS['change_profile']['databases'] = array('PluginDatabasesProfile', 'initProfile');
$PLUGIN_HOOKS['assign_to_ticket']['databases'] = true;
//$PLUGIN_HOOKS['assign_to_ticket_dropdown']['databases'] = true;
//$PLUGIN_HOOKS['assign_to_ticket_itemtype']['databases'] = array('PluginDatabasesDatabase_Item');
Plugin::registerClass('PluginDatabasesDatabase', array('linkgroup_tech_types' => true, 'linkuser_tech_types' => true, 'document_types' => true, 'ticket_types' => true, 'helpdesk_visible_types' => true, 'addtabon' => 'Supplier'));
Plugin::registerClass('PluginDatabasesProfile', array('addtabon' => 'Profile'));
//Plugin::registerClass('PluginDatabasesDatabase_Item',
// array('ticket_types' => true));
if (class_exists('PluginAccountsAccount')) {
PluginAccountsAccount::registerType('PluginDatabasesDatabase');
}
if (Session::getLoginUserID()) {
$plugin = new Plugin();
if (!$plugin->isActivated('environment') && Session::haveRight("plugin_databases", READ)) {
$PLUGIN_HOOKS['menu_toadd']['databases'] = array('assets' => 'PluginDatabasesMenu');
}
if (Session::haveRight("plugin_databases", UPDATE)) {
$PLUGIN_HOOKS['use_massive_action']['databases'] = 1;
}
if (class_exists('PluginDatabasesDatabase_Item')) {
// only if plugin activated
$PLUGIN_HOOKS['plugin_datainjection_populate']['databases'] = 'plugin_datainjection_populate_databases';
}
// End init, when all types are registered
$PLUGIN_HOOKS['post_init']['databases'] = 'plugin_databases_postinit';
// Import from Data_Injection plugin
$PLUGIN_HOOKS['migratetypes']['databases'] = 'plugin_datainjection_migratetypes_databases';
}
}
示例2: plugin_init_formcreator
/**
* Initialize all classes and generic variables of the plugin
*/
function plugin_init_formcreator()
{
global $PLUGIN_HOOKS;
// Add specific CSS
$PLUGIN_HOOKS['add_css']['formcreator'][] = "css/styles.css";
if (strpos($_SERVER['REQUEST_URI'], "front/helpdesk.public.php") !== false) {
$PLUGIN_HOOKS['add_javascript']['formcreator'][] = 'scripts/helpdesk.js';
} elseif (strpos($_SERVER['REQUEST_URI'], "front/central.php") !== false) {
$PLUGIN_HOOKS['add_javascript']['formcreator'][] = 'scripts/homepage.js';
}
if (isset($_SESSION['glpiactiveprofile'])) {
if ($_SESSION['glpiactiveprofile']['interface'] == 'helpdesk') {
$PLUGIN_HOOKS['add_javascript']['formcreator'][] = 'scripts/helpdesk-menu.js';
}
}
$PLUGIN_HOOKS['add_javascript']['formcreator'][] = 'scripts/forms-validation.js.php';
// Set the plugin CSRF compliance (required in GLPI 0.84)
$PLUGIN_HOOKS['csrf_compliant']['formcreator'] = true;
// Add a link in the main menu plugins for technician and admin panel
$PLUGIN_HOOKS['menu_entry']['formcreator'] = 'front/formlist.php';
// Config page
$plugin = new Plugin();
$links = array();
if (Session::haveRight('config', 'w') && $plugin->isActivated("formcreator")) {
$PLUGIN_HOOKS['config_page']['formcreator'] = 'front/form.php';
$links['config'] = '/plugins/formcreator/front/form.php';
$links['add'] = '/plugins/formcreator/front/form.form.php';
}
// Set options for pages (title, links, buttons...)
$links['search'] = '/plugins/formcreator/front/formlist.php';
$PLUGIN_HOOKS['submenu_entry']['formcreator']['options'] = array('config' => array('title' => __('Setup'), 'page' => '/plugins/formcreator/front/form.php', 'links' => $links), 'options' => array('title' => _n('Form', 'Forms', 2, 'formcreator'), 'links' => $links));
// Load field class and all its method to manage fields
Plugin::registerClass('PluginFormcreatorFields');
}
示例3: canView
static function canView()
{
if (static::$rightname) {
return Session::haveRight(static::$rightname, PluginTalkTicket::ACTIVE);
}
return false;
}
示例4: plugin_init_uninstall
/**
* Function Init
*/
function plugin_init_uninstall()
{
global $PLUGIN_HOOKS, $CFG_GLPI, $UNINSTALL_TYPES, $UNINSTALL_DIRECT_CONNECTIONS_TYPE;
$PLUGIN_HOOKS['csrf_compliant']['uninstall'] = true;
Plugin::registerClass('PluginUninstallPreference', array('addtabon' => array('Preference')));
Plugin::registerClass('PluginUninstallProfile', array('addtabon' => array('Profile')));
$plugin = new Plugin();
if ($plugin->isActivated('uninstall')) {
$UNINSTALL_TYPES = array('Computer', 'Monitor', 'NetworkEquipment', 'Peripheral', 'Phone', 'Printer');
$UNINSTALL_DIRECT_CONNECTIONS_TYPE = array('Monitor', 'Peripheral', 'Phone', 'Printer');
if (Session::getLoginUserID()) {
if (Session::haveRight(PluginUninstallProfile::$rightname, READ)) {
$PLUGIN_HOOKS['use_massive_action']['uninstall'] = true;
if (Session::haveRight('uninstall:profile', READ)) {
// Add link in GLPI plugins list :
$PLUGIN_HOOKS["menu_toadd"]['uninstall'] = array('admin' => 'PluginUninstallModel');
// add to 'Admin' menu :
$PLUGIN_HOOKS['config_page']['uninstall'] = "front/model.php";
}
//Item actions
$PLUGIN_HOOKS['item_update']['uninstall'] = array('PluginUninstallModel' => array('PluginUninstallPreference', 'afterUpdateModel'));
$PLUGIN_HOOKS['item_delete']['uninstall'] = array('PluginUninstallModel' => array('PluginUninstallPreference', 'beforeItemPurge'));
$PLUGIN_HOOKS['pre_item_purge']['uninstall'] = array('User' => array('PluginUninstallPreference', 'beforeItemPurge'));
}
}
$PLUGIN_HOOKS['post_init']['uninstall'] = 'plugin_uninstall_postinit';
}
}
示例5: getTabNameForItem
function getTabNameForItem(CommonGLPI $item, $withtemplate = 0)
{
if (in_array($item->getType(), self::getTypes(true)) && Session::haveRight("plugin_financialreports", READ)) {
return PluginFinancialreportsFinancialreport::getTypeName();
}
return '';
}
示例6: afterAdd
static function afterAdd(Group_Ticket $item)
{
global $DB;
//Toolbox::logDebug(__METHOD__, $item);
$config = PluginBehaviorsConfig::getInstance();
if ($config->getField('add_notif')) {
if ($item->getField('type') == CommonITILActor::ASSIGN) {
$ticket = new Ticket();
if ($ticket->getFromDB($item->getField('tickets_id'))) {
NotificationEvent::raiseEvent('plugin_behaviors_ticketnewgrp', $ticket);
}
}
}
// Check is the connected user is a tech
if (!is_numeric(Session::getLoginUserID(false)) || !Session::haveRight('own_ticket', 1)) {
return false;
// No check
}
$config = PluginBehaviorsConfig::getInstance();
if ($config->getField('single_tech_mode') != 0 && $item->input['type'] == CommonITILActor::ASSIGN) {
$crit = array('tickets_id' => $item->input['tickets_id'], 'type' => CommonITILActor::ASSIGN);
foreach ($DB->request('glpi_groups_tickets', $crit) as $data) {
if ($data['id'] != $item->getID()) {
$gu = new Group_Ticket();
$gu->delete($data);
}
}
if ($config->getField('single_tech_mode') == 2) {
foreach ($DB->request('glpi_tickets_users', $crit) as $data) {
$gu = new Ticket_User();
$gu->delete($data);
}
}
}
}
示例7: pdfForTicket
static function pdfForTicket(PluginPdfSimplePDF $pdf, Ticket $ticket)
{
global $CFG_GLPI, $DB;
$pdf->setColumnsSize(100);
$pdf->displayTitle("<b>" . __('Approvals for the ticket') . "</b>");
if (!Session::haveRight('validate_request', 1) && !Session::haveRight('validate_incident', 1) && !Session::haveRight('create_incident_validation', 1) && !Session::haveRight('create_request_validation', 1)) {
return false;
}
$ID = $ticket->getField('id');
$query = "SELECT *\n FROM `glpi_ticketvalidations`\n WHERE `tickets_id` = '" . $ticket->getField('id') . "'\n ORDER BY submission_date DESC";
$result = $DB->query($query);
$number = $DB->numrows($result);
if ($number) {
$pdf->setColumnsSize(20, 19, 21, 19, 21);
$pdf->displayTitle(_x('item', 'State'), __('Request date'), __('Approval requester'), __('Approval date'), __('Approver'));
while ($row = $DB->fetch_assoc($result)) {
$pdf->setColumnsSize(20, 19, 21, 19, 21);
$pdf->displayLine(TicketValidation::getStatus($row['status']), Html::convDateTime($row["submission_date"]), getUserName($row["users_id"]), Html::convDateTime($row["validation_date"]), getUserName($row["users_id_validate"]));
$tmp = trim($row["comment_submission"]);
$pdf->displayText("<b><i>" . sprintf(__('%1$s: %2$s'), __('Request comments') . "</i></b>", empty($tmp) ? __('None') : $tmp, 1));
if ($row["validation_date"]) {
$tmp = trim($row["comment_validation"]);
$pdf->displayText("<b><i>" . sprintf(__('%1$s: %2$s'), __('Approval comments') . "</i></b>", empty($tmp) ? __('None') : $tmp, 1));
}
}
} else {
$pdf->displayLine(__('No item found'));
}
$pdf->displaySpace();
}
示例8: plugin_tag_getAddSearchOptions
function plugin_tag_getAddSearchOptions($itemtype)
{
$sopt = array();
if (!Session::haveRight("itilcategory", READ)) {
return array();
}
if (strpos($itemtype, 'Plugin') !== false && strpos($itemtype, 'CronTask') !== false) {
return array();
}
if ($itemtype === 'PluginTagTag' || $itemtype === 'TicketTemplate' || strpos($itemtype, 'PluginPrintercounters') !== false) {
return array();
}
$rng1 = 10500;
//$sopt[strtolower($itemtype)] = ''; //self::getTypeName(2);
$sopt[$rng1]['table'] = getTableForItemType('PluginTagTag');
$sopt[$rng1]['field'] = 'name';
$sopt[$rng1]['name'] = _n('Tag', 'Tag', 2, 'tag');
$sopt[$rng1]['datatype'] = 'string';
$sopt[$rng1]['searchtype'] = "contains";
$sopt[$rng1]['massiveaction'] = false;
$sopt[$rng1]['forcegroupby'] = true;
$sopt[$rng1]['usehaving'] = true;
$sopt[$rng1]['joinparams'] = array('beforejoin' => array('table' => 'glpi_plugin_tag_tagitems', 'joinparams' => array('jointype' => "itemtype_item")));
//array('jointype' => "itemtype_item");
return $sopt;
}
示例9: plugin_init_certificates
function plugin_init_certificates()
{
global $PLUGIN_HOOKS;
$PLUGIN_HOOKS['csrf_compliant']['certificates'] = true;
$PLUGIN_HOOKS['change_profile']['certificates'] = array('PluginCertificatesProfile', 'initProfile');
$PLUGIN_HOOKS['assign_to_ticket']['certificates'] = true;
if (Session::getLoginUserID()) {
// Params : plugin name - string type - number - attributes
Plugin::registerClass('PluginCertificatesCertificate', array('linkgroup_tech_types' => true, 'linkuser_tech_types' => true, 'document_types' => true, 'helpdesk_visible_types' => true, 'ticket_types' => true, 'contract_types' => true, 'notificationtemplates_types' => true));
Plugin::registerClass('PluginCertificatesConfig', array('addtabon' => 'CronTask'));
Plugin::registerClass('PluginCertificatesProfile', array('addtabon' => 'Profile'));
if (class_exists('PluginAccountsAccount')) {
PluginAccountsAccount::registerType('PluginCertificatesCertificate');
}
$plugin = new Plugin();
if (!$plugin->isActivated('environment') && Session::haveRight("plugin_certificates", READ)) {
$PLUGIN_HOOKS['menu_toadd']['certificates'] = array('assets' => 'PluginCertificatesMenu');
}
if (Session::haveRight("plugin_certificates", UPDATE)) {
$PLUGIN_HOOKS['use_massive_action']['certificates'] = 1;
}
// End init, when all types are registered
$PLUGIN_HOOKS['post_init']['certificates'] = 'plugin_certificates_postinit';
}
}
示例10: plugin_init_barcode
function plugin_init_barcode()
{
global $PLUGIN_HOOKS, $LANG, $CFG_GLPI;
$PLUGIN_HOOKS['csrf_compliant']['barcode'] = true;
// Params : plugin name - string type - ID - Array of attributes
Plugin::registerClass('PluginBarcodeDropdown');
Plugin::registerClass('PluginBarcodeProfile', array('addtabon' => array('Profile')));
Plugin::registerClass('PluginBarcode');
// Display a menu entry ?
if (Session::haveRight('plugin_barcode_barcode', CREATE) || Session::haveRight('plugin_barcode_config', UPDATE)) {
$PLUGIN_HOOKS['pre_item_purge']['barcode'] = array('Profile' => array('PluginBarcodeProfile', 'cleanProfiles'));
// Massive Action definition
$PLUGIN_HOOKS['use_massive_action']['barcode'] = 1;
$PLUGIN_HOOKS['submenu_entry']['barcode']['options']['optionname']['title'] = "Search";
$PLUGIN_HOOKS['submenu_entry']['barcode']['options']['optionname']['page'] = '/plugins/barcode/front/barcode.php';
$PLUGIN_HOOKS['submenu_entry']['barcode']['options']['optionname']['links']['search'] = '/plugins/barcode/front/barcode.php';
$PLUGIN_HOOKS['submenu_entry']['barcode']['options']['optionname']['links']['add'] = '/plugins/barcode/front/barcode.form.php';
$PLUGIN_HOOKS['submenu_entry']['barcode']['options']['optionname']['links']['config'] = '/plugins/barcode/index.php';
$PLUGIN_HOOKS["helpdesk_menu_entry"]['barcode'] = true;
}
// Config page
if (Session::haveRight('config', UPDATE)) {
$PLUGIN_HOOKS['config_page']['barcode'] = 'front/config.php';
}
//redirect appel http://localhost/glpi/index.php?redirect=plugin_example_2 (ID 2 du form)
$PLUGIN_HOOKS['redirect_page']['barcode'] = 'barcode.form.php';
}
示例11: plugin_init_moreticket
function plugin_init_moreticket()
{
global $PLUGIN_HOOKS;
$PLUGIN_HOOKS['add_css']['moreticket'] = 'moreticket.css';
$PLUGIN_HOOKS['csrf_compliant']['moreticket'] = true;
$PLUGIN_HOOKS['change_profile']['moreticket'] = array('PluginMoreticketProfile', 'initProfile');
if (Session::getLoginUserID()) {
Plugin::registerClass('PluginMoreticketProfile', array('addtabon' => 'Profile'));
if (class_exists('PluginMoreticketProfile')) {
// only if plugin activated
$config = new PluginMoreticketConfig();
if (Session::haveRight("plugin_moreticket", UPDATE)) {
if (strpos($_SERVER['REQUEST_URI'], "ticket.form.php") !== false && ($config->useWaiting() == true || $config->useSolution() == true)) {
$PLUGIN_HOOKS['add_javascript']['moreticket'][] = 'scripts/moreticket.js';
$PLUGIN_HOOKS['add_javascript']['moreticket'][] = 'scripts/moreticket.js.php';
}
$PLUGIN_HOOKS['config_page']['moreticket'] = 'front/config.form.php';
$PLUGIN_HOOKS['pre_item_update']['moreticket'] = array('Ticket' => array('PluginMoreticketTicket', 'beforeUpdate'));
$PLUGIN_HOOKS['pre_item_add']['moreticket'] = array('Ticket' => array('PluginMoreticketTicket', 'beforeAdd'));
$PLUGIN_HOOKS['item_add']['moreticket'] = array('Ticket' => array('PluginMoreticketTicket', 'afterAdd'));
$PLUGIN_HOOKS['item_update']['moreticket'] = array('Ticket' => array('PluginMoreticketTicket', 'afterUpdate'));
$PLUGIN_HOOKS['item_empty']['moreticket'] = array('Ticket' => array('PluginMoreticketTicket', 'emptyTicket'));
}
if (Session::haveRight('plugin_moreticket', READ)) {
Plugin::registerClass('PluginMoreticketWaitingTicket', array('addtabon' => 'Ticket'));
Plugin::registerClass('PluginMoreticketCloseTicket', array('addtabon' => 'Ticket'));
}
}
}
}
示例12: plugin_init_datainjection
function plugin_init_datainjection()
{
global $PLUGIN_HOOKS, $CFG_GLPI, $INJECTABLE_TYPES;
$PLUGIN_HOOKS['csrf_compliant']['datainjection'] = true;
$PLUGIN_HOOKS['migratetypes']['datainjection'] = 'plugin_datainjection_migratetypes_datainjection';
$plugin = new Plugin();
if ($plugin->isActivated("datainjection")) {
Plugin::registerClass('PluginDatainjectionProfile', array('addtabon' => array('Profile')));
//If directory doesn't exists, create it
if (!plugin_datainjection_checkDirectories()) {
@mkdir(PLUGIN_DATAINJECTION_UPLOAD_DIR) or die(sprintf(__('%1$s %2$s'), __("Can't create folder", 'datainjection'), PLUGIN_DATAINJECTION_UPLOAD_DIR));
}
if (Session::haveRight('plugin_datainjection_model', READ)) {
$PLUGIN_HOOKS["menu_toadd"]['datainjection'] = array('tools' => 'PluginDatainjectionMenu');
}
$PLUGIN_HOOKS['pre_item_purge']['datainjection'] = array('Profile' => array('PluginDatainjectionProfile', 'purgeProfiles'));
// Css file
$PLUGIN_HOOKS['add_css']['datainjection'] = 'css/datainjection.css';
// Javascript file
$PLUGIN_HOOKS['add_javascript']['datainjection'] = 'javascript/datainjection.js';
// Inbtegration with Webservices plugin
$PLUGIN_HOOKS['webservices']['datainjection'] = 'plugin_datainjection_registerMethods';
$INJECTABLE_TYPES = array();
}
}
示例13: canCreate
/**
* Have I the global right to "create" the Object
* May be overloaded if needed (ex KnowbaseItem)
*
* @return booleen
**/
static function canCreate()
{
if (static::$rightname) {
return Session::haveRight(static::$rightname, UPDATE);
}
return false;
}
示例14: plugin_init_badges
function plugin_init_badges()
{
global $PLUGIN_HOOKS;
$PLUGIN_HOOKS['csrf_compliant']['badges'] = true;
$PLUGIN_HOOKS['assign_to_ticket']['badges'] = true;
$PLUGIN_HOOKS['change_profile']['badges'] = array('PluginBadgesProfile', 'initProfile');
if (Session::getLoginUserID()) {
Plugin::registerClass('PluginBadgesBadge', array('linkuser_types' => true, 'document_types' => true, 'helpdesk_visible_types' => true, 'ticket_types' => true, 'notificationtemplates_types' => true));
Plugin::registerClass('PluginBadgesProfile', array('addtabon' => 'Profile'));
Plugin::registerClass('PluginBadgesConfig', array('addtabon' => 'CronTask'));
if (class_exists('PluginResourcesResource')) {
PluginResourcesResource::registerType('PluginBadgesBadge');
}
$plugin = new Plugin();
if (!$plugin->isActivated('environment') && Session::haveRight("plugin_badges", READ)) {
$PLUGIN_HOOKS['menu_toadd']['badges'] = array('assets' => 'PluginBadgesMenu');
}
if (Session::haveRight("plugin_badges", UPDATE)) {
$PLUGIN_HOOKS['use_massive_action']['badges'] = 1;
}
if (class_exists('PluginBadgesBadge')) {
// only if plugin activated
$PLUGIN_HOOKS['plugin_datainjection_populate']['badges'] = 'plugin_datainjection_populate_badges';
}
// Import from Data_Injection plugin
$PLUGIN_HOOKS['migratetypes']['badges'] = 'plugin_datainjection_migratetypes_badges';
}
}
示例15: plugin_init_customfields
/**
* Initialize the plugin's hooks
*/
function plugin_init_customfields()
{
global $PLUGIN_HOOKS, $DB, $ACTIVE_CUSTOMFIELDS_TYPES, $ALL_CUSTOMFIELDS_TYPES;
$PLUGIN_HOOKS['csrf_compliant']['customfields'] = true;
$PLUGIN_HOOKS['change_profile']['customfields'] = array('PluginCustomfieldsProfile', 'changeprofile');
// Register classes
Plugin::registerClass('PluginCustomfieldsDropdowns');
Plugin::registerClass('PluginCustomfieldsFields');
if (isset($_SESSION['glpiID'])) {
$plugin = new Plugin();
if ($plugin->isInstalled("customfields") && $plugin->isActivated("customfields")) {
// enable a tab for reading / setting access rights for the plugin
Plugin::registerClass('PluginCustomfieldsProfile', array('addtabon' => 'Profile'));
// Display a menu entry in the main menu if the user has
// configuration rights
if (Session::haveRight('config', UPDATE)) {
// $PLUGIN_HOOKS['menu_entry']['customfields'] = true;
$PLUGIN_HOOKS["menu_toadd"]['customfields'] = array('plugins' => 'PluginCustomfieldsConfig');
}
// initiate empty dropdowns
$PLUGIN_HOOKS['item_empty']['customfields'] = array('PluginCustomfieldsDropdownsItem' => 'PluginCustomfieldsDropdownsItem::item_empty');
}
// Indicate where the configuration page can be found
if (Session::haveRight('config', UPDATE)) {
$PLUGIN_HOOKS['config_page']['customfields'] = 'front/config.form.php';
}
// Hook for initialization after initialization of all other plugins
$PLUGIN_HOOKS['post_init']['customfields'] = 'plugin_customfields_postinit';
}
}