Giter Site home page Giter Site logo

Comments (3)

hscstudio avatar hscstudio commented on August 11, 2024

mainkan aja di menu

from yii2-mimin.

jejehan avatar jejehan commented on August 11, 2024

mainkan dimenu?
maksudnya bagaimana ya?
untuk menu yang setau saya dia bisa mengelompokan saja kan?

kepikiran begini sih cuma belum berhasil.
sekarang lagi coba bikin kustom AccessControl yang di extends dari AccessControl Mimin.
jadi kalo dicek di tabel auth_assignment si item_name == 'customer', mau di redirect ke halaman notfound. kustom access controlnya dibuat khusus dibackend aja. jadi setiap user yang akses backend dia musti lewati pengecekan dulu disini. kalo rolesnya dia customer dia gak boleh akses, dan dialihkan ke halaman page notfound. itu berlaku hanya untuk customer aja, jika nanti ada roles baru misal "staff" dia masih bisa masuk backend dan menunya difilter pake filterRouteMenu.
barbar banget ya caranya. hehe

sementara bikin custom class begini isinya :( nambahin 1 field di user

namespace backend\components;
use Yii;
use hscstudio\mimin\components\AccessControl;

class AccessControlCustom extends AccessControl{
    public function __construct(){
      $user = $this->getUser();
      if($user->identity->user_type==2){ // 2= customer
        header("Location: http://localhost/advanced/frontend/web/error");
        die();
      }
    }
}

from yii2-mimin.

hscstudio avatar hscstudio commented on August 11, 2024

Gunakan filterRouteMenu sehingga menu yang akan muncul hanya untuk user spesifik

use hscstudio\mimin\components\Mimin;
// list semua menu baik untuk admin, staff, guest
$items = [
    ['label' => 'Home', 'url' => ['/site/index']],
    ['label' => 'Administrator', 'url' => ['/admin/index']],
    ['label' => 'Super Dewa', 'url' => ['/dewa/index']],
];
// filter
$items = Mimin::filterRouteMenu($items);
// setelah di filter gini, misal yang login guest ya cuman liat menu Home doang..
if(count($items)>0){
    $menuItems[] = ['label' => 'Reporting', 'items' => $items];
}

from yii2-mimin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.