Comments (13)
from php-casbin.
Can you provide more detailed information? I tried to implement similar logic in the middleware, but failed to reproduce the problem.
from php-casbin.
@490626721 Please provide your model file and all policies .
from php-casbin.
from php-casbin.
from php-casbin.
from php-casbin.
@490626721 This does not tell the problem. Have you made any changes to the adapter?
I guess it may be related to model configuration or loading policies, can you provide a tiny sample?
from php-casbin.
adapter file
[request_definition]
r = sub, obj, act
[policy_definition]
p = sub, obj, act
[role_definition]
g = _, _
[policy_effect]
e = some(where (p.eft == allow))
[matchers]
m = g(r.sub, p.sub) && r.obj == p.obj && r.act == p.act || r.sub == "root"
casbinConfig:
public function casbinConfig (): Enforcer
{
$config = [
'type' => 'mysql', // mysql,pgsql,sqlite,sqlsrv
'hostname' => Env::get('database.HOSTNAME'),
'database' => Env::get('database.DATABASE'),
'username' => Env::get('database.USERNAME'),
'password' => Env::get('database.PASSWORD'),
'hostport' => Env::get('database.HOSTPORT'),
];
$adapter = DatabaseAdapter::newAdapter($config);
$e = new Enforcer(config_path() . 'casbin.conf', $adapter);
return $e;
}
from php-casbin.
I found the problem:
error file path: casbin\src\Persist\AdapterHelper.php 32 line
Using The getcsv () method causes the program to miss some commas
from php-casbin.
@techoner
from php-casbin.
For str_getcsv()
, please refer to: https://www.php.net/manual/en/function.str-getcsv.php
Note:
The locale settings are taken into account by this function. If LC_CTYPE is e.g. en_US.UTF-8, strings in one-byte encodings may be read wrongly by this function.
In view of this, we need to use loadPolicyArray
in the DatabaseAdapter. Migrate to php-casbin/database-adapter#19
@490626721 By the way, I recommend using dbal-adapter instead of database-adapter.
from php-casbin.
For
str_getcsv()
, please refer to: https://www.php.net/manual/en/function.str-getcsv.phpNote: The locale settings are taken into account by this function. If LC_CTYPE is e.g. en_US.UTF-8, strings in one-byte encodings may be read wrongly by this function.
In view of this, we need to use
loadPolicyArray
in the DatabaseAdapter. Migrate to php-casbin/database-adapter#19@490626721 By the way, I recommend using dbal-adapter instead of database-adapter.
OK, I'll change it now 😄
from php-casbin.
Closed as resolved.
from php-casbin.
Related Issues (20)
- support Priority Explicitly or subjectPriority HOT 1
- Database Adapter class not updated with new updateFilteredPolicies HOT 3
- The result after packaging is not as expected HOT 3
- Issue in ManagementEnforcer : getAllSubject/Object... has field indexes hard coded HOT 3
- Enforcement results of the Casbin Editor and the enforce() PHP implementation differ HOT 4
- DeleteUser() removes roles but leaves permissions HOT 4
- [Feature] Add cache for g function HOT 3
- Could change addPermissionsForUser function declaration HOT 3
- May be should cast $name1 and $name2 to string before call hasLink function in generateGFunction. HOT 1
- Cannot use multiple policy rule HOT 2
- I got wrong match result from RBAC model HOT 11
- globMatch raises error HOT 1
- PHP Depreciated for php v8.2.0 : $this->enabled HOT 1
- composer is fetching v0.1.1 HOT 9
- Regression after RoleManager rewrite HOT 1
- RBAC with domain and domain pattern returns invalid results HOT 3
- ErrorException when some user belong no role in subjectPriority mode HOT 1
- Multiple request, policy, effect, matcher type support HOT 2
- Implement keyGet() and keyGet2() built-in method HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from php-casbin.