ThinkPHP3 in App_group_list group after RBAC no permission problem solution!!!
Reprint Please specify source: http://tyllxx.iteye.com/blog/1693553
Today in the official website Rbac example, extracted out into the Web site root directory, with the TP3.1 framework, running normally, enter also normal. The permissions are normal, and the database is not problematic.
Rename the profile to config.inc.php, put it in the app directory, and add it to the config file.
? ?? ???' App_group_list ' = ' admin,member ',
? ?? ???' Default_group ' = ',
After grouping the new Admin,member folder under the Conf folder, the directory contains the Config.php,conf folder with config.php (not the original), the contents are as follows:
$config =require './app/config.inc.php ';
$array =array ();
Return Array_merge ($config, $array);
Reprint Please specify source: http://tyllxx.iteye.com/blog/1693553?
In the Commonaction file:
if (! Rbac::accessdecision (group_name)) {//Add group_name parameter
Under the \lib\action folder, under Create a new Admin,member folder, copy the IndexAction.class.php file under the \lib\action folder to the newly created Admin,member two folder.
Under the \tpl folder, under Create a new Admin,member folder, copy the \tpl folder under the Index folder to the new Admin,member two folder.
Configure permissions in the database (for easy testing to remove permissions from the data table):
?
The following node table:
?
The following? Access table:
?
?
The following role table:
The following Role_user table:
Follow the above method to configure login success, but prompt no permission!
?
?
The solutions currently found are:
Modify RBAC Master file: \lib\org\util\rbac.class.php
It is not possible to find a matching value when reading level=1 data through the database, which causes no permissions problem.
Problem Statement:
?
?
$db = db::getinstance (C (' rbac_db_dsn ')); $table = Array (' Role ' =>c (' rbac_role_table '), ' user ' =>c (' rbac_user_table '), ' Access ' =>c (' Rbac_access_ TABLE '), ' node ' =>c (' rbac_node_table ')); $sql = "Select Node.id,node.name from". $table [' role ']. "As role,". $table [' User ']. "As user,". $table [' Access ']. "As access,". $table [' node ']. "As node". " Where user.user_id= ' {$authId} ' and User.role_id=role.id and (Access.role_id=role.id or (access.role_id=role.pid and role.pid!=0)) and Role.status=1 and Access.node_id=node.id and node.level=1 and Node.status=1 "; $apps = $db->query ($sql); reprint please specify Source: http://tyllxx.iteye.com/blog/1693553
?
of which:
"Where user.user_id= ' {$authId} ' and User.role_id=role.id and (access.role_id=role.id? or (Access.role_id=role.pid and role.pid!=0)) and Role.status=1 and Access.node_id=node.id and node.level=1 and Node.status=1 ";
?
Switch
?
"Where user.user_id= ' {$authId} ' and user.role_id=role.id? and Role.status=1 and Access.node_id=node.id and node.level=1 and Node.status=1 ";
?
You can correctly identify the permissions after grouping ....
?
In the configuration file
' Rbac_group_name ' = ' admin,member ',
This sentence does not know whether it is useful, not tested.
?