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


PHP K2HelperPermissions::getK2User方法代码示例

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


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

示例1: setPermissions

 function setPermissions()
 {
     $params =& JComponentHelper::getParams('com_k2');
     $user =& JFactory::getUser();
     if ($user->guest) {
         return;
     }
     $K2User = K2HelperPermissions::getK2User($user->id);
     if (!is_object($K2User)) {
         return;
     }
     $K2UserGroup = K2HelperPermissions::getK2UserGroup($K2User->group);
     if (is_null($K2UserGroup)) {
         return;
     }
     $permissions = new JParameter($K2UserGroup->permissions);
     $auth =& JFactory::getACL();
     if (count(JPluginHelper::getPlugin('system', 'jfdatabase')) && JPluginHelper::isEnabled('system', 'jfdatabase')) {
         $params->set('frontendEditing', 0);
     }
     if ($permissions->get('categories') == 'none') {
         return;
     } else {
         if ($permissions->get('categories') == 'all') {
             if ($permissions->get('add') && $permissions->get('frontEdit') && $params->get('frontendEditing')) {
                 $auth->addACL('com_k2', 'add', 'users', $user->usertype, 'category', 'all');
                 $auth->addACL('com_k2', 'tag', 'users', $user->usertype);
                 $auth->addACL('com_k2', 'extraFields', 'users', $user->usertype);
             }
             if ($permissions->get('editOwn') && $permissions->get('frontEdit') && $params->get('frontendEditing')) {
                 $auth->addACL('com_k2', 'editOwn', 'users', $user->usertype, 'item', $user->id);
                 $auth->addACL('com_k2', 'tag', 'users', $user->usertype);
                 $auth->addACL('com_k2', 'extraFields', 'users', $user->usertype);
             }
             if ($permissions->get('editAll') && $permissions->get('frontEdit') && $params->get('frontendEditing')) {
                 $auth->addACL('com_k2', 'editAll', 'users', $user->usertype, 'category', 'all');
                 $auth->addACL('com_k2', 'tag', 'users', $user->usertype);
                 $auth->addACL('com_k2', 'extraFields', 'users', $user->usertype);
             }
             if ($permissions->get('publish') && $permissions->get('frontEdit') && $params->get('frontendEditing')) {
                 $auth->addACL('com_k2', 'publish', 'users', $user->usertype, 'category', 'all');
             }
             if ($permissions->get('comment')) {
                 $auth->addACL('com_k2', 'comment', 'users', $user->usertype, 'category', 'all');
             }
         } else {
             $selectedCategories = $permissions->get('categories', NULL);
             if (is_string($selectedCategories)) {
                 $searchIDs[] = $selectedCategories;
             } else {
                 $searchIDs = $selectedCategories;
             }
             if ($permissions->get('inheritance')) {
                 foreach ($searchIDs as $catid) {
                     $childCategories = K2HelperPermissions::getCategoryChilds($catid);
                     $childIDs = array();
                     foreach ($childCategories as $child) {
                         $childIDs[] = $child;
                     }
                 }
                 $allIDs = @array_merge($searchIDs, $childIDs);
                 $categories = @array_unique($allIDs);
             } else {
                 $categories = $searchIDs;
             }
             if (is_array($categories) && count($categories)) {
                 foreach ($categories as $category) {
                     if ($permissions->get('add') && $permissions->get('frontEdit') && $params->get('frontendEditing')) {
                         $auth->addACL('com_k2', 'add', 'users', $user->usertype, 'category', $category);
                         $auth->addACL('com_k2', 'tag', 'users', $user->usertype);
                         $auth->addACL('com_k2', 'extraFields', 'users', $user->usertype);
                     }
                     if ($permissions->get('editOwn') && $permissions->get('frontEdit') && $params->get('frontendEditing')) {
                         $auth->addACL('com_k2', 'editOwn', 'users', $user->usertype, 'item', $user->id . '|' . $category);
                         $auth->addACL('com_k2', 'tag', 'users', $user->usertype);
                         $auth->addACL('com_k2', 'extraFields', 'users', $user->usertype);
                     }
                     if ($permissions->get('editAll') && $permissions->get('frontEdit') && $params->get('frontendEditing')) {
                         $auth->addACL('com_k2', 'editAll', 'users', $user->usertype, 'category', $category);
                         $auth->addACL('com_k2', 'tag', 'users', $user->usertype);
                         $auth->addACL('com_k2', 'extraFields', 'users', $user->usertype);
                     }
                     if ($permissions->get('publish') && $permissions->get('frontEdit') && $params->get('frontendEditing')) {
                         $auth->addACL('com_k2', 'publish', 'users', $user->usertype, 'category', $category);
                     }
                     if ($permissions->get('comment')) {
                         $auth->addACL('com_k2', 'comment', 'users', $user->usertype, 'category', $category);
                     }
                 }
             }
         }
     }
     return;
 }
开发者ID:navinpai,项目名称:GEC-Tandav,代码行数:94,代码来源:permissions.php

示例2: setPermissions

 public static function setPermissions()
 {
     $params = K2HelperUtilities::getParams('com_k2');
     $user = JFactory::getUser();
     if ($user->guest) {
         return;
     }
     $K2User = K2HelperPermissions::getK2User($user->id);
     if (!is_object($K2User)) {
         return;
     }
     $K2UserGroup = K2HelperPermissions::getK2UserGroup($K2User->group);
     if (is_null($K2UserGroup)) {
         return;
     }
     $K2Permissions = K2Permissions::getInstance();
     $permissions = K2_JVERSION == '15' ? new JParameter($K2UserGroup->permissions) : new JRegistry($K2UserGroup->permissions);
     $K2Permissions->permissions = $permissions;
     if ($permissions->get('categories') == 'none') {
         return;
     } else {
         if ($permissions->get('categories') == 'all') {
             if ($permissions->get('add') && $permissions->get('frontEdit') && $params->get('frontendEditing')) {
                 $K2Permissions->actions[] = 'add.category.all';
                 $K2Permissions->actions[] = 'tag';
                 $K2Permissions->actions[] = 'extraFields';
             }
             if ($permissions->get('editOwn') && $permissions->get('frontEdit') && $params->get('frontendEditing')) {
                 $K2Permissions->actions[] = 'editOwn.item.' . $user->id;
                 $K2Permissions->actions[] = 'tag';
                 $K2Permissions->actions[] = 'extraFields';
             }
             if ($permissions->get('editAll') && $permissions->get('frontEdit') && $params->get('frontendEditing')) {
                 $K2Permissions->actions[] = 'editAll.category.all';
                 $K2Permissions->actions[] = 'tag';
                 $K2Permissions->actions[] = 'extraFields';
             }
             if ($permissions->get('publish') && $permissions->get('frontEdit') && $params->get('frontendEditing')) {
                 $K2Permissions->actions[] = 'publish.category.all';
             }
             if ($permissions->get('comment')) {
                 $K2Permissions->actions[] = 'comment.category.all';
             }
             if ($permissions->get('editPublished')) {
                 $K2Permissions->actions[] = 'editPublished.category.all';
             }
         } else {
             $selectedCategories = $permissions->get('categories', NULL);
             if (is_string($selectedCategories)) {
                 $searchIDs[] = $selectedCategories;
             } else {
                 $searchIDs = $selectedCategories;
             }
             if ($permissions->get('inheritance')) {
                 $model = K2Model::getInstance('Itemlist', 'K2Model');
                 $categories = $model->getCategoryTree($searchIDs);
             } else {
                 $categories = $searchIDs;
             }
             if (is_array($categories) && count($categories)) {
                 foreach ($categories as $category) {
                     if ($permissions->get('add') && $permissions->get('frontEdit') && $params->get('frontendEditing')) {
                         $K2Permissions->actions[] = 'add.category.' . $category;
                         $K2Permissions->actions[] = 'tag';
                         $K2Permissions->actions[] = 'extraFields';
                     }
                     if ($permissions->get('editOwn') && $permissions->get('frontEdit') && $params->get('frontendEditing')) {
                         $K2Permissions->actions[] = 'editOwn.item.' . $user->id . '.' . $category;
                         $K2Permissions->actions[] = 'tag';
                         $K2Permissions->actions[] = 'extraFields';
                     }
                     if ($permissions->get('editAll') && $permissions->get('frontEdit') && $params->get('frontendEditing')) {
                         $K2Permissions->actions[] = 'editAll.category.' . $category;
                         $K2Permissions->actions[] = 'tag';
                         $K2Permissions->actions[] = 'extraFields';
                     }
                     if ($permissions->get('publish') && $permissions->get('frontEdit') && $params->get('frontendEditing')) {
                         $K2Permissions->actions[] = 'publish.category.' . $category;
                     }
                     if ($permissions->get('comment')) {
                         $K2Permissions->actions[] = 'comment.category.' . $category;
                     }
                     if ($permissions->get('editPublished')) {
                         $K2Permissions->actions[] = 'editPublished.category.' . $category;
                     }
                 }
             }
         }
     }
     return;
 }
开发者ID:educakanchay,项目名称:educa,代码行数:91,代码来源:permissions.php

示例3: setPermissions

 function setPermissions()
 {
     $params =& K2HelperUtilities::getParams('com_k2');
     $user =& JFactory::getUser();
     if ($user->guest) {
         return;
     }
     $K2User = K2HelperPermissions::getK2User($user->id);
     if (!is_object($K2User)) {
         return;
     }
     $K2UserGroup = K2HelperPermissions::getK2UserGroup($K2User->group);
     if (is_null($K2UserGroup)) {
         return;
     }
     $K2Permissions =& K2Permissions::getInstance();
     $permissions = new JParameter($K2UserGroup->permissions);
     $K2Permissions->permissions = $permissions;
     if ($permissions->get('categories') == 'none') {
         return;
     } else {
         if ($permissions->get('categories') == 'all') {
             if ($permissions->get('add') && $permissions->get('frontEdit') && $params->get('frontendEditing')) {
                 $K2Permissions->actions[] = 'add.category.all';
                 $K2Permissions->actions[] = 'tag';
                 $K2Permissions->actions[] = 'extraFields';
             }
             if ($permissions->get('editOwn') && $permissions->get('frontEdit') && $params->get('frontendEditing')) {
                 $K2Permissions->actions[] = 'editOwn.item.' . $user->id;
                 $K2Permissions->actions[] = 'tag';
                 $K2Permissions->actions[] = 'extraFields';
             }
             if ($permissions->get('editAll') && $permissions->get('frontEdit') && $params->get('frontendEditing')) {
                 $K2Permissions->actions[] = 'editAll.category.all';
                 $K2Permissions->actions[] = 'tag';
                 $K2Permissions->actions[] = 'extraFields';
             }
             if ($permissions->get('publish') && $permissions->get('frontEdit') && $params->get('frontendEditing')) {
                 $K2Permissions->actions[] = 'publish.category.all';
             }
             if ($permissions->get('comment')) {
                 $K2Permissions->actions[] = 'comment.category.all';
             }
         } else {
             $selectedCategories = $permissions->get('categories', NULL);
             if (is_string($selectedCategories)) {
                 $searchIDs[] = $selectedCategories;
             } else {
                 $searchIDs = $selectedCategories;
             }
             if ($permissions->get('inheritance')) {
                 JLoader::register('K2ModelItemlist', JPATH_SITE . DS . 'components' . DS . 'com_k2' . DS . 'models' . DS . 'itemlist.php');
                 $categories = K2ModelItemlist::getCategoryTree($searchIDs);
             } else {
                 $categories = $searchIDs;
             }
             if (is_array($categories) && count($categories)) {
                 foreach ($categories as $category) {
                     if ($permissions->get('add') && $permissions->get('frontEdit') && $params->get('frontendEditing')) {
                         $K2Permissions->actions[] = 'add.category.' . $category;
                         $K2Permissions->actions[] = 'tag';
                         $K2Permissions->actions[] = 'extraFields';
                     }
                     if ($permissions->get('editOwn') && $permissions->get('frontEdit') && $params->get('frontendEditing')) {
                         $K2Permissions->actions[] = 'editOwn.item.' . $user->id . '.' . $category;
                         $K2Permissions->actions[] = 'tag';
                         $K2Permissions->actions[] = 'extraFields';
                     }
                     if ($permissions->get('editAll') && $permissions->get('frontEdit') && $params->get('frontendEditing')) {
                         $K2Permissions->actions[] = 'editAll.category.' . $category;
                         $K2Permissions->actions[] = 'tag';
                         $K2Permissions->actions[] = 'extraFields';
                     }
                     if ($permissions->get('publish') && $permissions->get('frontEdit') && $params->get('frontendEditing')) {
                         $K2Permissions->actions[] = 'publish.category.' . $category;
                     }
                     if ($permissions->get('comment')) {
                         $K2Permissions->actions[] = 'comment.category.' . $category;
                     }
                 }
             }
         }
     }
     return;
 }
开发者ID:vuchannguyen,项目名称:dayhoc,代码行数:85,代码来源:permissions.php


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