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


PHP JControllerForm::allowEdit方法代码示例

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


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

示例1: allowEdit

 protected function allowEdit($data = array(), $key = 'id')
 {
     $recordId = (int) isset($data[$key]) ? $data[$key] : 0;
     $user = JFactory::getUser();
     $userId = $user->get('id');
     $rootCategory = JUDirectoryFrontHelperCategory::getRootCategory();
     if ($recordId && $recordId == $rootCategory->id) {
         return false;
     }
     if ($user->authorise('judir.category.edit', 'com_judirectory.category.' . $recordId)) {
         return true;
     }
     if ($user->authorise('judir.category.edit.own', 'com_judirectory.category.' . $recordId)) {
         $ownerId = (int) isset($data['created_by']) ? $data['created_by'] : 0;
         if (empty($ownerId) && $recordId) {
             $record = $this->getModel()->getItem($recordId);
             if (empty($record)) {
                 return false;
             }
             $ownerId = $record->created_by;
         }
         if ($ownerId == $userId) {
             return true;
         }
     }
     return parent::allowEdit($data, $key);
 }
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:27,代码来源:category.php

示例2: allowEdit

 /**
  * Method override to check if you can edit an existing record.
  *
  * @param     array      $data    An array of input data.
  * @param     string     $key     The name of the key for the primary key.
  *
  * @return    boolean
  */
 protected function allowEdit($data = array(), $key = 'id')
 {
     $user = JFactory::getUser();
     $uid = $user->get('id');
     $id = (int) isset($data[$key]) ? $data[$key] : 0;
     $owner = (int) isset($data['created_by']) ? $data['created_by'] : 0;
     // Check general edit permission first.
     if ($user->authorise('core.edit', 'com_pfrepo.directory.' . $id)) {
         return true;
     }
     // Fallback on edit.own.
     if ($user->authorise('core.edit.own', 'com_pfrepo.directory.' . $id)) {
         // Now test the owner is the user.
         if (!$owner && $id) {
             $record = $this->getModel()->getItem($id);
             if (empty($record)) {
                 return false;
             }
             $owner = $record->created_by;
         }
         if ($owner == $uid) {
             return true;
         }
     }
     // Fall back to the component permissions.
     return parent::allowEdit($data, $key);
 }
开发者ID:gagnonjeanfrancois,项目名称:Projectfork,代码行数:35,代码来源:directory.php

示例3: allowEdit

 /**
  * Method to check if you can edit a record.
  *
  * @param   array   $data  An array of input data.
  * @param   string  $key   The name of the key for the primary key.
  *
  * @return  boolean
  *
  * @since   3.1
  */
 protected function allowEdit($data = array(), $key = 'id')
 {
     $user = JFactory::getUser();
     $recordId = (int) isset($data[$key]) ? $data[$key] : 0;
     // Since there is no asset tracking and no categories, revert to the component permissions.
     return parent::allowEdit($data, $key);
 }
开发者ID:GitIPFire,项目名称:Homeworks,代码行数:17,代码来源:tag.php

示例4: allowEdit

 /**
  * Method override to check if you can edit an existing record.
  *
  * @param   array   $data  An array of input data.
  * @param   string  $key   The name of the key for the primary key.
  *
  * @return  boolean
  *
  * @since   1.6
  */
 protected function allowEdit($data = array(), $key = 'id')
 {
     $recordId = (int) isset($data[$key]) ? $data[$key] : 0;
     $user = JFactory::getUser();
     $userId = $user->get('id');
     // Check general edit permission first.
     if ($user->authorise('core.edit', 'com_places.point.' . $recordId)) {
         return true;
     }
     // Fallback on edit.own.
     // First test if the permission is available.
     if ($user->authorise('core.edit.own', 'com_places.point.' . $recordId)) {
         // Now test the owner is the user.
         $ownerId = (int) isset($data['created_by']) ? $data['created_by'] : 0;
         if (empty($ownerId) && $recordId) {
             // Need to do a lookup from the model.
             $record = $this->getModel()->getItem($recordId);
             if (empty($record)) {
                 return false;
             }
             $ownerId = $record->created_by;
         }
         // If the owner matches 'me' then do the test.
         if ($ownerId == $userId) {
             return true;
         }
     }
     // Since there is no asset tracking, revert to the component permissions.
     return parent::allowEdit($data, $key);
 }
开发者ID:buyanov,项目名称:com_places,代码行数:40,代码来源:point.php

示例5: allowEdit

 /**
  * Method override to check if you can edit an existing record.
  *
  * @param   array   $data  An array of input data.
  * @param   string  $key   The name of the key for the primary key.
  *
  * @return  boolean
  *
  * @since   1.6
  */
 protected function allowEdit($data = array(), $key = 'id')
 {
     $recordId = (int) isset($data[$key]) ? $data[$key] : 0;
     $user = JFactory::getUser();
     $userId = $user->get('id');
     $canDo = ZhYandexMapHelper::getMarkerActions($recordId);
     $canEdit = $canDo->get('core.edit');
     $isEnabledEditOwn = $canDo->get('core.edit.own');
     if ($canEdit || $canEditOwn) {
     }
     // Check general edit permission first.
     if ($canEdit) {
         return true;
     }
     // Fallback on edit.own.
     // First test if the permission is available.
     if ($isEnabledEditOwn) {
         // Now test the owner is the user.
         $ownerId = (int) isset($data['createdbyuser']) ? $data['createdbyuser'] : 0;
         if (empty($ownerId) && $recordId) {
             // Need to do a lookup from the model.
             $record = $this->getModel()->getItem($recordId);
             if (empty($record)) {
                 return false;
             }
             $ownerId = $record->createdbyuser;
         }
         // If the owner matches 'me' then do the test.
         if ($ownerId == $userId) {
             return true;
         }
     }
     // Since there is no asset tracking, revert to the component permissions.
     return parent::allowEdit($data, $key);
 }
开发者ID:pupsikus,项目名称:bs.test,代码行数:45,代码来源:mapmarker.php

示例6: allowEdit

 /**
  * Method override to check if you can edit an existing record.
  *
  * @param   array   $data  An array of input data.
  * @param   string  $key   The name of the key for the primary key.
  *
  * @return  boolean
  *
  * @since   1.6
  */
 protected function allowEdit($data = array(), $key = 'id')
 {
     $permissions = SibdietHelper::getUserPermissions();
     $recordId = (int) isset($data[$key]) ? $data[$key] : 0;
     $user = JFactory::getUser();
     $userId = $user->get('id');
     // Check requests manage permission first.
     if ($this->input->get('return') == 'requestschecks') {
         if (in_array('requestschecks', $permissions)) {
             return parent::allowEdit($data, $key);
         }
     } elseif (in_array('requests', $permissions)) {
         // Check that diet not started
         if ($recordId) {
             // Need to do a lookup from the model.
             $record = $this->getModel()->getItem($recordId);
             if ($record->room1 || $record->room2 || $record->room3 || $record->room4 || $record->room5 || $record->room6) {
                 return false;
             }
             // Now test the owner is the user.
             $ownerId = (int) isset($data['created_by']) ? $data['created_by'] : 0;
             if (empty($ownerId)) {
                 if (empty($record)) {
                     return false;
                 }
                 $ownerId = $record->created_by;
             }
             // If the owner matches 'me' then do the test.
             if ($ownerId == $userId) {
                 return true;
             }
         }
     }
     return false;
 }
开发者ID:smhnaji,项目名称:sdnet,代码行数:45,代码来源:request.php

示例7: allowEdit

 /**
  * Method override to check if you can edit an existing record.
  *
  * @param   array   $data  An array of input data.
  * @param   string  $key   The name of the key for the primary key.
  *
  * @return  boolean
  *
  * @since   1.6
  */
 protected function allowEdit($data = array(), $key = 'id')
 {
     $recordId = (int) isset($data[$key]) ? $data[$key] : 0;
     $user = JFactory::getUser();
     $userId = $user->get('id');
     // If we get a deny at the component level, we cannot override here.
     if (!parent::allowEdit($data, $key)) {
         return false;
     }
     // Check general edit permission first.
     if ($user->authorise('core.edit', 'com_content.article.' . $recordId)) {
         return true;
     }
     // Fallback on edit.own.
     // First test if the permission is available.
     if ($user->authorise('core.edit.own', 'com_content.article.' . $recordId)) {
         // Now test the owner is the user.
         $ownerId = (int) isset($data['created_by']) ? $data['created_by'] : 0;
         if (empty($ownerId) && $recordId) {
             // Need to do a lookup from the model.
             $record = $this->getModel()->getItem($recordId);
             if (empty($record)) {
                 return false;
             }
             $ownerId = $record->created_by;
         }
         // If the owner matches 'me' then permission is granted.
         if ($ownerId == $userId) {
             return true;
         }
     }
     return false;
 }
开发者ID:adjaika,项目名称:J3Base,代码行数:43,代码来源:article.php

示例8: allowEdit

 protected function allowEdit($data = array(), $key = 'id')
 {
     if (JAccess::check($data[$key], 'core.admin')) {
         if (!JFactory::getUser()->authorise('core.admin')) {
             return false;
         }
     }
     return parent::allowEdit($data, $key);
 }
开发者ID:juanferden,项目名称:adoperp,代码行数:9,代码来源:socialconnect.php

示例9: allowEdit

 /**
  * Method override to check if you can edit an existing record.
  *
  * @param   array   $data  An array of input data.
  * @param   string  $key   The name of the key for the primary key.
  *
  * @return  boolean
  *
  * @since   1.6
  */
 protected function allowEdit($data = array(), $key = 'id')
 {
     $permissions = SibdietHelper::getUserPermissions();
     if (in_array('sweeteners', $permissions)) {
         return parent::allowEdit($data, $key);
     } else {
         return false;
     }
 }
开发者ID:smhnaji,项目名称:sdnet,代码行数:19,代码来源:sweetener.php

示例10: allowEdit

 /**
  * Overrides JControllerForm::allowEdit
  *
  * Checks that non-Super Admins are not editing Super Admins.
  *
  * @param	array	An array of input data.
  * @param	string	The name of the key for the primary key.
  *
  * @return	boolean
  * @since	1.6
  */
 protected function allowEdit($data = array(), $key = 'id')
 {
     // Edit a Super Admin User Group is only allowed to a Super Admin
     if (JAccess::checkGroup($data[$key], 'core.admin')) {
         if (!JFactory::getUser()->authorise('core.admin')) {
             return false;
         }
     }
     return parent::allowEdit($data, $key);
 }
开发者ID:khetsothea,项目名称:flexicontent-cck,代码行数:21,代码来源:group.php

示例11: allowEdit

 protected function allowEdit($data = array(), $key = 'id')
 {
     $user = JFactory::getUser();
     $allow = null;
     $allow = $user->authorise('core.edit', 'com_phocagallery');
     if ($allow === null) {
         return parent::allowEdit($data, $key);
     } else {
         return $allow;
     }
 }
开发者ID:scarsroga,项目名称:blog-soa,代码行数:11,代码来源:phocagallerym.php

示例12: allowEdit

 /**
  * Переопределение метода для проверки,
  * может ли пользователь редактировать существующую запись.
  *
  * @param   array   $data  Массив данных.
  * @param   string  $key   Имя первичного ключа.
  *
  * @return  boolean  True, если разрешено редактировать запись.
  */
 protected function allowEdit($data = array(), $key = 'id')
 {
     $recordId = (int) isset($data[$key]) ? $data[$key] : 0;
     if ($recordId) {
         // Проверка редактирования на уровне записи.
         return JFactory::getUser()->authorise('core.edit', $this->option . '.message.' . $recordId);
     } else {
         // Проверка редактирования на уровне компонента.
         return parent::allowEdit($data, $key);
     }
 }
开发者ID:thebeuving,项目名称:joomla-25-component-example,代码行数:20,代码来源:helloworld.php

示例13: allowEdit

 /**
  * Overrides JControllerForm::allowEdit
  *
  * Checks that non-Super Admins are not editing Super Admins.
  *
  * @param   array   $data  An array of input data.
  * @param   string  $key   The name of the key for the primary key.
  *
  * @return  boolean  True if allowed, false otherwise.
  *
  * @since   1.6
  */
 protected function allowEdit($data = array(), $key = 'id')
 {
     // Check if this person is a Super Admin
     if (JAccess::check($data[$key], 'core.admin')) {
         // If I'm not a Super Admin, then disallow the edit.
         if (!User::authorise('core.admin')) {
             return false;
         }
     }
     return parent::allowEdit($data, $key);
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:23,代码来源:user.php

示例14: allowEdit

 /**
  * Method to check if you can add a new record.
  *
  * @param   array   $data  An array of input data.
  * @param   string  $key   The name of the key for the primary key.
  *
  * @return  boolean
  *
  * @since   1.0.0
  */
 protected function allowEdit($data = array(), $key = 'id')
 {
     $user = JFactory::getUser();
     // If the category has been passed in the URL check it.
     $allow = $user->authorise('core.edit', $this->option . '.discount');
     if ($allow !== null) {
         return $allow;
     }
     // Since there is no asset tracking, revert to the component permissions.
     return parent::allowEdit($data, $key);
 }
开发者ID:Shtier,项目名称:digicom,代码行数:21,代码来源:discount.php

示例15: allowEdit

 /**
  * Method to check if you can edit a record.
  *
  * @param    array    $data    An array of input data.
  * @param    string    $key    The name of the key for the primary key.
  *
  * @return    boolean
  * @since    1.6
  */
 protected function allowEdit($data = array(), $key = 'id')
 {
     // Initialise variables.
     $user = JFactory::getUser();
     $allow = null;
     $allow = $user->authorise('core.edit', 'com_jdownloads');
     if ($allow === null) {
         return parent::allowEdit($data, $key);
     } else {
         return $allow;
     }
 }
开发者ID:madcsaba,项目名称:li-de,代码行数:21,代码来源:template.php


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