uasoft-indonesia / badaso

Laravel Vue headless CMS / admin panel / dashboard / builder / API CRUD generator, anything !
https://badaso.uatech.co.id
MIT License
1.21k stars 223 forks source link

Permission is too complex #922

Closed Nemure231 closed 1 year ago

Nemure231 commented 1 year ago

Is your feature request related to a problem? Please describe. Hey, i don't really understand with badaso permission. Why would we need to define many permissions add, delete, edit etc for each database table? I mean right now its looks like: brower_tablename, edit_tablename for every table. It was such a pain to set all of them, if i have many tables

Describe the solution you'd like Why not define by role? I think its more simple like so: user_access admin_access all_access

Describe alternatives you've considered For example every route that define by user_access permission is only accessable by user. If we want to set it to spesific route controller middleware, just set like this:

Route::group(['prefix' => 'table'], function () {

    // Just spesific role can access this
    Route::get('', [TableController::class, 'browse'])->middleware([BadasoCheckPermissions::class . ':user_access']);
    Route::get('{id}', [TableController::class, 'read'])->middleware([BadasoCheckPermissions::class . ':admin_access']);

    //or maybe define the list access by comma
    Route::get('{id}', [TableController::class, 'delete'])->middleware([BadasoCheckPermissions::class . ':admin_access,:user_access']);

    //all role can access all
    Route::post('', [TableController::class, 'add'])->middleware([BadasoCheckPermissions::class . ':all_access']);

    // or i don't define route middleware if you want to allow all role access the controller
    Route::put('{id}', [TableController::class, 'edit'])
});

Additional context I don't have any

rizkiheryandi commented 1 year ago

if you have complex system, sometime you need a role can access a feature but only browse or read and cannot add or edit