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


PHP midcom_connection::is_admin方法代码示例

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


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

示例1: add_host_management_commands

 /**
  * Adds the Host management commands to the specified toolbar.
  *
  * Repeated calls to the same toolbar are intercepted accordingly.
  *
  * @param midcom_helper_toolbar &$toolbar A reference to the toolbar to use.
  * @param int $context_id The context to use (the topic is drawn from there). This defaults
  *     to the currently active context.
  */
 function add_host_management_commands(&$toolbar, $context_id = null)
 {
     if (array_key_exists('midcom_services_toolbars_bound_to_host', $toolbar->customdata)) {
         // We already processed this toolbar, skipping further adds.
         return;
     } else {
         $toolbar->customdata['midcom_services_toolbars_bound_to_host'] = true;
     }
     if (midcom::get('auth')->user) {
         $toolbar->add_item(array(MIDCOM_TOOLBAR_URL => midcom_connection::get_url('self') . "midcom-logout-", MIDCOM_TOOLBAR_LABEL => midcom::get('i18n')->get_string('logout', 'midcom'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/exit.png', MIDCOM_TOOLBAR_ACCESSKEY => 'l'));
     }
     $toolbar->add_item(array(MIDCOM_TOOLBAR_URL => midcom_connection::get_url('self') . "__mfa/asgard/", MIDCOM_TOOLBAR_LABEL => midcom::get('i18n')->get_string('midgard.admin.asgard', 'midgard.admin.asgard'), MIDCOM_TOOLBAR_ICON => 'midgard.admin.asgard/asgard2-16.png', MIDCOM_TOOLBAR_ACCESSKEY => 'a', MIDCOM_TOOLBAR_ENABLED => midcom::get('auth')->can_user_do('midgard.admin.asgard:access', null, 'midgard_admin_asgard_plugin', 'midgard.admin.asgard')));
     if (midcom_connection::is_admin()) {
         $toolbar->add_item(array(MIDCOM_TOOLBAR_URL => midcom_connection::get_url('self') . "midcom-cache-invalidate", MIDCOM_TOOLBAR_LABEL => midcom::get('i18n')->get_string('invalidate cache', 'midcom'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/stock_refresh.png'));
         $toolbar->add_item(array(MIDCOM_TOOLBAR_URL => midcom_connection::get_url('self') . "midcom-exec-midcom/config-test.php", MIDCOM_TOOLBAR_LABEL => midcom::get('i18n')->get_string('test settings', 'midcom'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/start-here.png'));
     }
 }
开发者ID:nemein,项目名称:openpsa,代码行数:26,代码来源:toolbars.php

示例2: _initialize_user_from_midgard

 /**
  * Internal startup helper, synchronizes the authenticated user with the Midgard Authentication
  * for startup. This will be overridden by MidCOM Auth, but is there for compatibility reasons.
  */
 private function _initialize_user_from_midgard()
 {
     if (midcom_connection::get_user() && ($user = $this->get_user(midcom_connection::get_user()))) {
         $this->user = $user;
         if (midcom_connection::is_admin() || midcom_connection::get('root')) {
             $this->admin = true;
         }
     }
 }
开发者ID:nemein,项目名称:openpsa,代码行数:13,代码来源:main.php

示例3: get_child_objects

 /**
  * Get children of given object
  *
  * @param midgard_object &$object object to get children for
  * @param boolean $deleted whether to get (only) deleted or not-deleted objects
  * @return array multidimensional array (keyed by classname) of objects or false on failure
  */
 public static function get_child_objects(&$object, $deleted = false)
 {
     // PONDER: Check for some generic user privilege instead  ??
     if ($deleted && !midcom_connection::is_admin()) {
         debug_add('Non-admins are not allowed to list deleted objects', MIDCOM_LOG_ERROR);
         return false;
     }
     $resolver = new midcom_helper_reflector_tree($object);
     $child_classes = $resolver->get_child_classes();
     if (!$child_classes) {
         if ($child_classes === false) {
             debug_add('resolver returned false (critical failure) from get_child_classes()', MIDCOM_LOG_ERROR);
         }
         return false;
     }
     //make sure children of the same type come out on top
     $i = 0;
     foreach ($child_classes as $child_class) {
         if (midcom::get('dbfactory')->is_a($object, $child_class)) {
             unset($child_classes[$i]);
             array_unshift($child_classes, $child_class);
             break;
         }
         $i++;
     }
     $child_objects = array();
     foreach ($child_classes as $schema_type) {
         $type_children = $resolver->_get_child_objects_type($schema_type, $object, $deleted);
         // PONDER: check for boolean false as result ??
         if (empty($type_children)) {
             unset($type_children);
             continue;
         }
         $child_objects[$schema_type] = $type_children;
         unset($type_children);
     }
     return $child_objects;
 }
开发者ID:nemein,项目名称:openpsa,代码行数:45,代码来源:tree.php


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