luyadev / luya-module-admin

Administration base module for all LUYA admin modules
https://luya.io
MIT License
48 stars 56 forks source link

Cannot save permissions without the view option #531

Open mrtrinhvn opened 4 years ago

mrtrinhvn commented 4 years ago

What steps will reproduce the problem?

In the admin, go to System => Group => A list of user group will be show. Point the mouse too the Three dots at the end of a group's line, then click the Group permissions icon (image of a shield). The permission table of that group will be showed up. There are: Each line, there will be 4 option: View , Add, Edit, Delete Just check 1, 2, or 3 options without the first option, then click Save button

What is the expected result?

The selected options should be saved. For example, I just want adding and Editing

What do you get instead? (A Screenshot can help us a lot!)

Every option become unchecked, that's mean no option applied.

LUYA Check ouput (run this script and post the result: luyacheck.php)

1: [in_array('mod_rewrite', apache_get_modules())] true 2: [ini_get('short_open_tag')] '' 3: [ini_get('error_reporting')] '22527' 4: [phpversion()] '7.1.13' 5: [php_ini_loaded_file()] '/etc/opt/remi/php71/php.ini' 6: [php_sapi_name()] 'apache2handler' 7: [isset($_SERVER['SERVER_SOFTWARE']) ? $_SERVER['SERVER_SOFTWARE'] : unknown] 'Apache/2.2.15 (CentOS)'

Additional infos

Q A
LUYA Version 1.3.1
nadar commented 4 years ago

Thanks for the report, i will do some tests.

nadar commented 4 years ago

(I also want to say, if you enable only edit and update for a certain item, you won't see this menu entry, so you are not able to click in the admin menu, but for api users - this makes sense)

mrtrinhvn commented 4 years ago

I want to show Just the Entry menu for Benhnhan If in Module.php public function getMenu() { return (new \luya\admin\components\AdminMenuBuilder($this)) ->node('Bệnh nhân', 'local_library') ->group('Các nội dung') ->itemApi('Bệnh nhân', 'thongtinbenhnhanadmin/benhnhan/index', 'account_box', 'api-thongtinbenhnhan-benhnhan'); //->itemApi('Phiếu theo dõi', 'thongtinbenhnhanadmin/phieutheodoi/index', 'receipt', 'api-thongtinbenhnhan-phieutheodoi'); }

I have public functions in the Benhnhan model

_ public ngRestRelations() { ... 'targetModel' => \app\modules\thongtinbenhnhan\models\Phieutheodoi::class, ... } public function getPhieu() { return $this->hasMany(Phieutheodoi::class, ['benhnhanid' => 'id']); } ...

The problem will be show as below: Invalid Configuration – yii\base\InvalidConfigException The configured api relation 'api-thongtinbenhnhan-phieutheodoi' does not exists in the menu elements. Maybe you have no permissions to access this API.

nadar commented 4 years ago

yes, maybe we should then just hide the relations button.