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


PHP DataObject::canEdit方法代码示例

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


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

示例1: canDelete

 /**
  * standard SS method
  * @param Member $member
  * @return Boolean
  */
 public function canDelete($member = null)
 {
     if (Permission::checkMember($member, Config::inst()->get("EcommerceRole", "admin_permission_code"))) {
         return true;
     }
     return parent::canEdit($member);
 }
开发者ID:helpfulrobot,项目名称:sunnysideup-ecommerce,代码行数:12,代码来源:SearchReplacement.php

示例2: getColumnContent

 /**
  *
  * @param GridField $gridField
  * @param DataObject $record
  * @param string $columnName
  * @return string - the HTML for the column 
  */
 public function getColumnContent($gridField, $record, $columnName)
 {
     if (!$record->canEdit()) {
         return;
     }
     $data = new ArrayData(array('Link' => Controller::join_links(Director::baseURL(), '/admin/pages/edit/show/', $record->ID)));
     return $data->renderWith('GridFieldEditButton');
 }
开发者ID:helpfulrobot,项目名称:micschk-silverstripe-gridfieldsitetreebuttons,代码行数:15,代码来源:GridFieldEditSiteTreeItemButton.php

示例3: getColumnContent

 /**
  *
  * @param GridField $gridField
  * @param DataObject $record
  * @param string $columnName
  * @return string - the HTML for the column 
  */
 public function getColumnContent($gridField, $record, $columnName)
 {
     if (!$record->canEdit()) {
         return;
     }
     $data = new ArrayData(array('Link' => Controller::join_links($gridField->Link('item'), $record->ID, 'edit')));
     return $data->renderWith('GridFieldEditButton');
 }
开发者ID:prostart,项目名称:cobblestonepath,代码行数:15,代码来源:GridFieldEditButton.php

示例4: canEdit

 public function canEdit($member = null)
 {
     $this->beforeExtending(__FUNCTION__, function ($member = null) {
         if ($this->Parent && $this->Parent->canEdit($member)) {
             return true;
         }
     });
     return parent::canEdit($member);
 }
开发者ID:spekulatius,项目名称:ss-social-feed,代码行数:9,代码来源:SocialFeed_Profile.php

示例5: getColumnContent

 /**
  * @param GridField $gridField
  * @param DataObject $record
  * @param string $columnName
  * @return string - the HTML for the column
  */
 public function getColumnContent($gridField, $record, $columnName)
 {
     if (!$record->canEdit()) {
         return;
     }
     $history_controller = singleton('CMSPageHistoryController');
     $data = new ArrayData(array('Link' => Controller::join_links($history_controller->Link('show'), $record->ID)));
     return $data->renderWith('GridFieldPageHistoryButton');
 }
开发者ID:helpfulrobot,项目名称:briceburg-silverstripe-pageholder,代码行数:15,代码来源:GridFieldPageHistoryButton.php

示例6: canEdit

 /**
  * Standard SS Method
  * @param Member $member
  * @var Boolean
  */
 public function canEdit($member = null)
 {
     if (!$member) {
         $member == Member::currentUser();
     }
     $shopAdminCode = EcommerceConfig::get("EcommerceRole", "admin_permission_code");
     if ($member && Permission::checkMember($member, $shopAdminCode)) {
         return true;
     }
     return parent::canEdit($member);
 }
开发者ID:nieku,项目名称:silverstripe-ecommerce,代码行数:16,代码来源:EcommerceDBConfig.php

示例7: deleteinlinecomment

 public function deleteinlinecomment(array $data, Form $form, $request)
 {
     if (!$this->context->canEdit()) {
         return;
     }
     if (!isset($data['ID'])) {
         throw new Exception("Invalid comment ID");
     }
     $comment = DataObject::get_by_id('InlineComment', $data['ID']);
     $comment->delete();
     return singleton('ICUtils')->ajaxResponse("Deleted", true);
 }
开发者ID:nyeholt,项目名称:silverstripe-inlinecomments,代码行数:12,代码来源:InlineCommentForm.php

示例8: checkPerm

 /**
  * Return true or false as to whether a given user can access an object
  * 
  * @param DataObject $node
  *			The object to check perms on
  * @param string $perm
  *			The permission to check against
  * @param Member $member 
  *			The member to check - if not set, the current user is used
  * 
  * @return type 
  */
 public function checkPerm(DataObject $node, $perm, $member = null)
 {
     // if the node doesn't use the extension, fall back to SS logic
     if (!$node->hasExtension('Restrictable')) {
         switch ($perm) {
             case 'View':
                 return $node->canView($member);
             case 'Write':
                 return $node->canEdit($member);
             default:
                 return $node->can($perm, $member);
         }
     }
     if (!$node) {
         return false;
     }
     if (!$member) {
         $member = singleton('SecurityContext')->getMember();
     }
     if (is_int($member)) {
         $member = DataObject::get_by_id('Member', $member);
     }
     if (Permission::check('ADMIN', 'any', $member)) {
         return true;
     }
     $permCache = $this->getCache();
     /* @var $permCache Zend_Cache_Core */
     $key = $this->permCacheKey($node, $perm);
     $userGrants = null;
     if ($key) {
         $userGrants = $permCache->load($key);
         if (count($userGrants)) {
             $userGrants = $this->sanitiseCacheData($userGrants);
         }
     }
     if ($member && $userGrants && isset($userGrants[$perm][$member->ID])) {
         return $userGrants[$perm][$member->ID];
     }
     // okay, we need to build up all the info we have about the node for permissions
     $s = $this->realiseAllSources($node);
     if (!$userGrants) {
         $userGrants = array();
     }
     if (!isset($userGrants[$perm])) {
         $userGrants[$perm] = array();
     }
     $result = null;
     // if no member, just check public view
     $public = $this->checkPublicPerms($node, $perm);
     if ($public) {
         $result = true;
     }
     // can return immediately
     if (!$member) {
         return $result;
     }
     if (is_null($result)) {
         // see whether we're the owner, and if the perm we're checking is in that list
         if ($this->checkOwnerPerms($node, $perm, $member)) {
             $result = true;
         }
     }
     $accessAuthority = '';
     $directGrant = null;
     $can = false;
     if (is_null($result)) {
         $filter = array('ItemID' => $node->ID, 'ItemType' => $node->class);
         $existing = DataList::create('AccessAuthority')->filter($filter);
         // get all access authorities for this object
         $gids = isset($this->groups[$member->ID]) ? $this->groups[$member->ID] : null;
         if (!$gids) {
             $groups = $member ? $member->Groups() : array();
             $gids = array();
             if ($groups && $groups->Count()) {
                 $gids = $groups->map('ID', 'ID')->toArray();
             }
             $this->groups[$member->ID] = $gids;
         }
         $can = false;
         $directGrant = 'NONE';
         if ($existing && $existing->count()) {
             foreach ($existing as $access) {
                 // check if this mentions the perm in question
                 $perms = $access->Perms->getValues();
                 if ($perms) {
                     if (!in_array($perm, $perms)) {
                         continue;
                     }
//.........这里部分代码省略.........
开发者ID:nyeholt,项目名称:silverstripe-restrictedobjects,代码行数:101,代码来源:PermissionService.php

示例9: canEdit

 /**
  * Shop Admins can edit
  * @return Boolean
  */
 function canEdit($member = null)
 {
     return true;
     if (!$member) {
         $member = Member::currentUser();
     }
     if ($member && $member->IsShopAdmin()) {
         return true;
     }
     return parent::canEdit($member);
 }
开发者ID:TouchtechLtd,项目名称:silverstripe-ecommerce_product_variation,代码行数:15,代码来源:ProductVariation.php

示例10: canDelete

 /**
  * Standard SS method
  * @param Member $member
  * @return Boolean
  */
 public function canDelete($member = null)
 {
     //cant delete last status if there are orders with this status
     $nextOrderStepObject = $this->NextOrderStep();
     if ($nextOrderStepObject) {
         //do nothing
     } else {
         $orderCount = Order::get()->filter(array("StatusID" => intval($this->ID) - 0))->count();
         if ($orderCount) {
             return false;
         }
     }
     if ($this->isDefaultStatusOption()) {
         return false;
     }
     if (in_array($this->Code, self::get_codes_for_order_steps_to_include())) {
         return false;
     }
     if (Permission::checkMember($member, Config::inst()->get("EcommerceRole", "admin_permission_code"))) {
         return true;
     }
     return parent::canEdit($member);
 }
开发者ID:TouchtechLtd,项目名称:silverstripe-ecommerce,代码行数:28,代码来源:OrderStep.php

示例11: canDelete

 /**
  * Standard SS method
  * @param Member $member
  * @return Boolean
  */
 function canDelete($member = null)
 {
     if (ShippingAddress::get()->filter(array("ShippingCountry" => $this->Code))->count()) {
         return false;
     }
     if (BillingAddress::get()->filter(array("Country" => $this->Code))->count()) {
         return false;
     }
     if (Permission::checkMember($member, Config::inst()->get("EcommerceRole", "admin_permission_code"))) {
         return true;
     }
     return parent::canEdit($member);
 }
开发者ID:helpfulrobot,项目名称:sunnysideup-ecommerce,代码行数:18,代码来源:EcommerceCountry.php

示例12: canEdit

 public function canEdit($member = null)
 {
     $this->beforeExtending(__METHOD__, function ($member) {
         if (!$this->checkIfHasGlobalMenuPermission($member)) {
             return false;
         }
     });
     return parent::canEdit($member);
 }
开发者ID:helpfulrobot,项目名称:milkyway-multimedia-ss-linkable-menus,代码行数:9,代码来源:LinkableMenu.php

示例13: canEdit

 public function canEdit($member = null)
 {
     $first = $this->Pages()->first();
     return $first ? $first->canEdit() : parent::canEdit($member);
 }
开发者ID:helpfulrobot,项目名称:silverstripe-australia-silverstripe-question-answer,代码行数:5,代码来源:QuestionAnswerObject.php

示例14: canDelete

 /**
  * Standard SS method
  * @param Member $member
  * @return Boolean
  */
 function canDelete($member = null)
 {
     if (!$this->InUse && EcommerceCurrency::get()->Count() > 1) {
         if (Permission::checkMember($member, Config::inst()->get("EcommerceRole", "admin_permission_code"))) {
             return true;
         }
         return parent::canEdit($member);
     }
     return false;
 }
开发者ID:helpfulrobot,项目名称:sunnysideup-ecommerce,代码行数:15,代码来源:EcommerceCurrency.php

示例15: getColumnContent

 /**
  *
  * @param GridField $gridField
  * @param DataObject $record
  * @param string $columnName
  * @return string - the HTML for the column
  */
 public function getColumnContent($gridField, $record, $columnName)
 {
     if ($this->removeRelation) {
         if (!$record->canEdit()) {
             return;
         }
         $field = GridField_FormAction::create($gridField, 'UnlinkRelation' . $record->ID, _t('GridAction.UnlinkRelation', "Unlink"), "unlinkrelation", array('RecordID' => $record->ID))->addExtraClass('gridfield-button-unlink')->setAttribute('title', _t('GridAction.UnlinkRelation', "Unlink"))->setAttribute('data-icon', 'chain--minus');
     } else {
         if (!$record->canDelete()) {
             return;
         }
         $field = GridField_FormAction::create($gridField, 'DeleteRecord' . $record->ID, _t('GridAction.Delete', "Delete"), "deleterecord", array('RecordID' => $record->ID))->addExtraClass('gridfield-button-delete')->setAttribute('title', _t('GridAction.Delete', "Delete"))->setAttribute('data-icon', 'cross-circle')->setDescription(_t('GridAction.DELETE_DESCRIPTION', 'Delete'));
     }
     return $field->Field();
 }
开发者ID:congaaids,项目名称:silverstripe-framework,代码行数:22,代码来源:GridFieldDeleteAction.php


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