Search
 
SCRIPT & CODE EXAMPLE
 

PHP

drupal 9 custom access checking for routes

<?php

namespace DrupalmymodAccess;

use DrupalCoreRoutingAccessAccessInterface;
use DrupalCoreAccessAccessResult;
use DrupalmymodStoreService;


class CardEditAccessChecker implements AccessInterface {
  // injected StoreService
  private $ss = NULL;
  
  public function __construct(StoreService $ss) {
    $this->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();
  }
}
Comment

PREVIOUS NEXT
Code Example
Php :: how to explode results from multi select form submitted 
Php :: Add Spatie provider to providers 
Php :: The provided cwd "C:laravel projectseccomer/../public_html" 
Php :: Comment ajouter nofollow à un lien spécifique ou à tous les liens WordPress dans the_content 
Php :: Laravel function to check if image exist or not 
Php :: laravel make request 
Php :: how to make login and logout to blog with php without database or MySQL 
Php :: white labeling wordpress divi 
Php :: PHP strspn — Finds the length of the initial segment of a string consisting entirely of characters contained within a given mask 
Php :: create random username and password php 
Php :: laravel collection min 
Php :: breaking long array in php 
Php :: fat-free captcha plugin 
Php :: wp post view1 
Php :: how to fix 419 page expired in laravel 
Php :: Change initial country + add top countiries on Caldera forms 
Php :: ipay generate hash id 
Php :: validation ignored rules 
Php :: image downlord 
Php :: Laravel 8 Factory - One To Many (Polymorphic) Relationship 
Php :: laravel pass multipale provider 
Php :: codeigniter 4 query builder select 
Php :: laravel migration add column first 
Php :: convert string to int php 
Php :: php pretty json 
Php :: php cheat sheet 
Php :: crrate model in laravel 
Php :: change php version 
Java :: java get class by string 
Java :: how to get witdth of window android 
ADD CONTENT
Topic
Content
Source link
Name
5+7 =