Skip to content

Commit 40cf312

Browse files
Updated Dependencies and Fixed Linter Bugs
1 parent b15f6c3 commit 40cf312

File tree

11 files changed

+24
-27
lines changed

11 files changed

+24
-27
lines changed

.github/workflows/pythonapp.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
runs-on: ubuntu-latest
1212
strategy:
1313
matrix:
14-
python-version: ["3.7", "3.8", "3.9", "3.10"]
14+
python-version: ["3.8", "3.9", "3.10"]
1515
name: Python ${{ matrix.python-version }}
1616
steps:
1717
- uses: actions/checkout@v4

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@ coverage.xml
1313
dist
1414
.env
1515
*.db
16-
src/masonite_masonite_permission.egg-info
17-
storage/app/*
16+
src/masonite_permission.egg-info
17+
storage/app/*

makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ help: ## Show this help
33
@egrep -h '\s##\s' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
44

55
init: ## Install package dependencies
6-
cp .env-example .env
6+
cp .env.example .env
77
pip install --upgrade pip
88
# install test project and package dependencies
99
pip install -r requirements.txt

masonite.sqlite3

0 Bytes
Binary file not shown.

setup.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
# Versions should comply with PEP440. For a discussion on single-sourcing
99
# the version across setup.py and the project code, see
1010
# https://packaging.python.org/en/latest/single_source_version.html
11-
version="0.2.1",
11+
version="1.0.0",
1212
packages=[
1313
"masonite_permission",
1414
"masonite_permission.config",
@@ -48,7 +48,6 @@
4848
"Operating System :: OS Independent",
4949
# Specify the Python versions you support here. In particular, ensure
5050
# that you indicate whether you support Python 2, Python 3 or both.
51-
"Programming Language :: Python :: 3.7",
5251
"Programming Language :: Python :: 3.8",
5352
"Programming Language :: Python :: 3.9",
5453
"Topic :: Software Development :: Libraries :: Application Frameworks",
@@ -62,7 +61,7 @@
6261
# your project is installed. For an analysis of "install_requires" vs pip's
6362
# requirements files see:
6463
# https://packaging.python.org/en/latest/requirements.html
65-
install_requires=["masonite>=4.0<5.0"],
64+
install_requires=["masonite>=4.0,<5.0"],
6665
# List additional groups of dependencies here (e.g. development
6766
# dependencies). You can install these using the following syntax,
6867
# for example:

src/masonite_permission/mixins/has_permissions.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ def give_permission_to(self, *args):
103103
"""Give permission to related model"""
104104
from ..models.permission import Permission
105105

106-
if type(args[0]) == list:
106+
if type(args[0]) is list:
107107
args = args[0]
108108

109109
permissions = Permission.where_in("slug", args).get()
@@ -132,7 +132,7 @@ def revoke_permission_to(self, *args):
132132
"""Revoke permission from related model"""
133133
from ..models.permission import Permission
134134

135-
if type(args[0]) == list:
135+
if type(args[0]) is list:
136136
args = args[0]
137137

138138
permissions = Permission.where_in("slug", args).get()
@@ -158,7 +158,7 @@ def _get_permission_ids(self, args):
158158
).where("permissionable_type", self.get_table_name()).delete()
159159
return
160160

161-
if type(args[0]) == list:
161+
if type(args[0]) is list:
162162
args = args[0]
163163

164164
for permission in args:
@@ -208,15 +208,15 @@ def sync_permissions(self, *args):
208208
query.bulk_create(data)
209209

210210
def has_permission_to(self, permission):
211-
if type(permission) != str:
211+
if type(permission) is not str:
212212
raise PermissionException("permission must be a string!")
213213
return self._permission_query().where("permissions.slug", permission).count() > 0
214214

215215
def has_any_permission(self, *args):
216216
"""Check if user has any of the permissions"""
217217

218218
slugs = []
219-
if type(args[0]) == list:
219+
if type(args[0]) is list:
220220
slugs = args[0]
221221
else:
222222
slugs = list(args)
@@ -227,7 +227,7 @@ def has_all_permissions(self, *args):
227227
"""Check if user has all of the permissions"""
228228

229229
slugs = []
230-
if type(args[0]) == list:
230+
if type(args[0]) is list:
231231
slugs = args[0]
232232
else:
233233
slugs = list(args)
@@ -236,7 +236,7 @@ def has_all_permissions(self, *args):
236236

237237
def can_(self, permissions):
238238
"""Check if user has a permission"""
239-
if type(permissions) != str:
239+
if type(permissions) is not str:
240240
raise PermissionException("permission must be a string!")
241241

242242
action = "all" # can be all or any

src/masonite_permission/mixins/has_roles.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ def roles(self):
1616

1717
def has_role_of(self, role):
1818
"""Check if user has a role"""
19-
if type(role) != str:
19+
if type(role) is not str:
2020
raise PermissionException("role must be a string!")
2121
return self.roles().where("slug", role).count() > 0
2222

2323
def has_any_role(self, *args):
2424
"""Check if user has any of the roles"""
2525

2626
slugs = []
27-
if type(args[0]) == list:
27+
if type(args[0]) is list:
2828
slugs = args[0]
2929
else:
3030
slugs = list(args)
@@ -35,7 +35,7 @@ def has_all_roles(self, *args):
3535
"""Check if user has all of the roles"""
3636

3737
slugs = []
38-
if type(args[0]) == list:
38+
if type(args[0]) is list:
3939
slugs = args[0]
4040
else:
4141
slugs = list(args)
@@ -52,7 +52,7 @@ def _get_role_ids(self, args):
5252
QueryBuilder().table("role_user").where("user_id", self.id).delete()
5353
return
5454

55-
if type(args[0]) == list:
55+
if type(args[0]) is list:
5656
args = args[0]
5757

5858
for role in args:
@@ -139,7 +139,7 @@ def revoke_role(self, role):
139139

140140
def is_(self, roles):
141141
"""Check if user has a role"""
142-
if type(roles) != str:
142+
if type(roles) is not str:
143143
raise PermissionException("role must be a string!")
144144

145145
action = "all" # can be all or any

src/masonite_permission/models/permission.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def sync_roles(self, *args):
3636
).where("permission_id", self.id).delete()
3737
return
3838

39-
if type(args[0]) == list:
39+
if type(args[0]) is list:
4040
args = args[0]
4141

4242
for role in args:
@@ -77,11 +77,11 @@ def attach_role(self, role):
7777
"""
7878
from ..models.role import Role
7979

80-
if type(role) == str:
80+
if type(role) is str:
8181
role = Role.where("slug", role).first()
8282
if not role:
8383
raise PermissionException(f"Role: {role} does not exist!")
84-
elif type(role) == int:
84+
elif type(role) is int:
8585
role = Role.find(role)
8686
if not role:
8787
raise PermissionException(f"Role: with id {role} does not exist!")
@@ -112,11 +112,11 @@ def detach_role(self, role):
112112
"""
113113
from ..models.role import Role
114114

115-
if type(role) == str:
115+
if type(role) is str:
116116
role = Role.where("slug", role).first()
117117
if not role:
118118
raise PermissionException(f"Role: {role} does not exist!")
119-
elif type(role) == int:
119+
elif type(role) is int:
120120
role = Role.find(role)
121121
if not role:
122122
raise PermissionException(f"Role: with id {role} does not exist!")

src/masonite_permission/models/role.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def sync_permissions(self, *args):
4141
).where("permissionable_type", self.get_table_name()).delete()
4242
return
4343

44-
if type(args[0]) == list:
44+
if type(args[0]) is list:
4545
args = args[0]
4646

4747
for permission in args:

tests/integrations/Kernel.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919

2020
class Kernel:
21-
2221
http_middleware = [MaintenanceModeMiddleware, EncryptCookies]
2322

2423
route_middleware = {

tests/integrations/app/middlewares/VerifyCsrfToken.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,4 @@
22

33

44
class VerifyCsrfToken(Middleware):
5-
65
exempt = ["/filemanager"]

0 commit comments

Comments
 (0)