Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add support for add_domain_matching_function #165

Merged
merged 6 commits into from
Jun 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions casbin/core_enforcer.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,11 +237,11 @@ def add_named_matching_func(self, ptype, fn):

def add_named_domain_matching_func(self, ptype, fn):
"""add_named_domain_matching_func add MatchingFunc by ptype to RoleManager"""
try:
if ptype in self.rm_map.keys():
self.rm_map[ptype].add_domain_matching_func(fn)
return True
except:
return False

return False

def enforce(self, *rvals):
"""decides whether a "subject" can access a "object" with the operation "action",
Expand Down
2 changes: 1 addition & 1 deletion casbin/enforcer.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def get_implicit_roles_for_user(self, name, domain=None):

return res

def get_implicit_permissions_for_user(self, user, domain=None):
def get_implicit_permissions_for_user(self, user, domain=""):
"""
gets implicit permissions for a user or role.
Compared to get_permissions_for_user(), this function retrieves permissions for inherited roles.
Expand Down
Loading