📜  drupal 9 路由的自定义访问检查 - PHP 代码示例

📅  最后修改于: 2022-03-11 14:53:46.827000             🧑  作者: Mango

代码示例1
ss = $ss;
  }
  
  public function access($product_id) {
    // marketplace manager can edit all...
    if ($this->ss->isMarketPlaceManager()) {
      return AccessResult::allowed();
    }
 
    // product owner can edit...
    if ($this->ss->ownsProduct($product_id)) {
      return AccessResult::allowed();
    }
    
    return AccessResult::forbidden();
  }
}