@@ -103,7 +103,7 @@ def give_permission_to(self, *args):
103
103
"""Give permission to related model"""
104
104
from ..models .permission import Permission
105
105
106
- if type (args [0 ]) == list :
106
+ if type (args [0 ]) is list :
107
107
args = args [0 ]
108
108
109
109
permissions = Permission .where_in ("slug" , args ).get ()
@@ -132,7 +132,7 @@ def revoke_permission_to(self, *args):
132
132
"""Revoke permission from related model"""
133
133
from ..models .permission import Permission
134
134
135
- if type (args [0 ]) == list :
135
+ if type (args [0 ]) is list :
136
136
args = args [0 ]
137
137
138
138
permissions = Permission .where_in ("slug" , args ).get ()
@@ -158,7 +158,7 @@ def _get_permission_ids(self, args):
158
158
).where ("permissionable_type" , self .get_table_name ()).delete ()
159
159
return
160
160
161
- if type (args [0 ]) == list :
161
+ if type (args [0 ]) is list :
162
162
args = args [0 ]
163
163
164
164
for permission in args :
@@ -208,15 +208,15 @@ def sync_permissions(self, *args):
208
208
query .bulk_create (data )
209
209
210
210
def has_permission_to (self , permission ):
211
- if type (permission ) != str :
211
+ if type (permission ) is not str :
212
212
raise PermissionException ("permission must be a string!" )
213
213
return self ._permission_query ().where ("permissions.slug" , permission ).count () > 0
214
214
215
215
def has_any_permission (self , * args ):
216
216
"""Check if user has any of the permissions"""
217
217
218
218
slugs = []
219
- if type (args [0 ]) == list :
219
+ if type (args [0 ]) is list :
220
220
slugs = args [0 ]
221
221
else :
222
222
slugs = list (args )
@@ -227,7 +227,7 @@ def has_all_permissions(self, *args):
227
227
"""Check if user has all of the permissions"""
228
228
229
229
slugs = []
230
- if type (args [0 ]) == list :
230
+ if type (args [0 ]) is list :
231
231
slugs = args [0 ]
232
232
else :
233
233
slugs = list (args )
@@ -236,7 +236,7 @@ def has_all_permissions(self, *args):
236
236
237
237
def can_ (self , permissions ):
238
238
"""Check if user has a permission"""
239
- if type (permissions ) != str :
239
+ if type (permissions ) is not str :
240
240
raise PermissionException ("permission must be a string!" )
241
241
242
242
action = "all" # can be all or any
0 commit comments