Skip to content

Commit d81664a

Browse files
author
Zeeland
authored
docs: adjust code block indent (#11)
1 parent 3d8f3d6 commit d81664a

1 file changed

Lines changed: 14 additions & 14 deletions

File tree

README.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -34,20 +34,20 @@ MIDDLEWARE = [
3434
```python
3535
import casbin
3636

37-
def __init__(self, get_response):
38-
self.get_response = get_response
39-
# load the casbin model and policy from files.
40-
# change the 2nd arg to use a database.
41-
self.enforcer = casbin.Enforcer("casbin_middleware/authz_model.conf", "casbin_middleware/authz_policy.csv")
42-
43-
def check_permission(self, request):
44-
# change the user, path, method as you need.
45-
user = request.user.username
46-
if request.user.is_anonymous:
47-
user = 'anonymous'
48-
path = request.path
49-
method = request.method
50-
return self.enforcer.enforce(user, path, method)
37+
def __init__(self, get_response):
38+
self.get_response = get_response
39+
# load the casbin model and policy from files.
40+
# change the 2nd arg to use a database.
41+
self.enforcer = casbin.Enforcer("casbin_middleware/authz_model.conf", "casbin_middleware/authz_policy.csv")
42+
43+
def check_permission(self, request):
44+
# change the user, path, method as you need.
45+
user = request.user.username
46+
if request.user.is_anonymous:
47+
user = 'anonymous'
48+
path = request.path
49+
method = request.method
50+
return self.enforcer.enforce(user, path, method)
5151
```
5252

5353
- The default policy ``authz_policy.csv`` is:

0 commit comments

Comments
 (0)