def has_perm(self, perm, obj=None): # "Does the user have a specific permission?" # Simplest possible answer: Yes, always if self.is_active and self.is_superuser: return True return _user_has_perm(self, perm, obj)
def has_perm(self, perm, obj=None): # Active superusers have all permissions. if self.is_active and self.is_admin: return True # Otherwise we need to check the backends. return _user_has_perm(self, perm, obj)
def has_perm(self, perm, obj=None): # Active superusers have all permissions. if self.is_active and self.is_superuser: return True # Otherwise we need to check the backends. return _user_has_perm(self, perm, obj)
def has_perm(self, perm, obj=None): """ :param perm: :param obj: :return: """ return _user_has_perm(self, perm, obj)
def _check_perm(self, perm, obj): if not getattr(settings, 'DJEM_UNIVERSAL_OLP', False): # Default behaviour: active superusers implicitly have ALL permissions if self.is_active and self.is_superuser: return True, 'Active superuser: Implicit permission' return _user_has_perm(self, perm, obj), None else: # "Universal OLP" behaviour: active superusers implicitly have all # permissions at the model level, but are subject to object-level # checks if not obj and self.is_active and self.is_superuser: return True, 'Active superuser: Implicit permission (model-level)' return _user_has_perm(self, perm, obj), None
def has_perm(self, perm: Union[BasePermissionEnum, str], obj=None): # type: ignore # This method is overridden to accept perm as BasePermissionEnum perm = perm.value if hasattr(perm, "value") else perm # type: ignore # Active superusers have all permissions. if self.is_active and self.is_superuser and not self._effective_permissions: return True return _user_has_perm(self, perm, obj)
def has_perm(self, perm, obj=None): from django.contrib.auth.models import _user_has_perm # Active superusers have all permissions. if self.is_active and self.is_superuser: return True # Otherwise we need to check the backends. return _user_has_perm(self, perm, obj)
def has_perm(self, perm, obj=None): """ Returns True if the user has the specified permission. This method queries all available auth backends, but returns immediately if any backend returns True. Thus, a user who has permission from a single auth backend is assumed to have permission in general. If an object is provided, permissions for this specific object are checked. """ return _user_has_perm(self, perm, obj)
def has_perm(self, perm, obj=None): "Does the user have a specific permission?" # Simplest possible answer: Yes, always # print('user perm:',perm) if not self.is_active: return False if self.is_admin: return True return _user_has_perm(self, perm, obj)
def has_perm(self, perm, obj=None): ''' Checks if the user has a specific permission ''' # Active admins have all permissions if self.is_active and self.is_admin: return True # Otherwise we need to check the backends return _user_has_perm(self, perm, obj)
def has_perm(self, perm, obj=None): """ Checks whether a user has the given permission. :param perm: A string identifying the permission. See the backends module in this app for a complete list. :param obj: An optional object, the interpretation of which depends on the permission string. :return: True or False :raises: ``InvalidPermission`` if the given permission string is unknown, or if the optional ``obj`` is an unexpected type. """ return _user_has_perm(self, perm, obj)
def has_perm(self, perm, obj=None): """ Override PermissionsMixin has_perm to deactivate is_superuser if authenticated through a token """ # Active superusers have all permissions. if self.is_active and self.is_superuser and not hasattr(self, "token"): return True # Otherwise we need to check the backends. return _user_has_perm(self, perm, obj)
def has_perm(self, perm, obj=None): """Return True if the reviewer has the specified permission. Query all available auth backends, but return immediately if any backend returns True. Thus, a reviewer who has permission from a single auth backend is assumed to have permission in general. If an object is provided, check permissions for that object. """ # Active superusers have all permissions. if self.is_active and self.trusted: return True # Otherwise we need to check the backends. return auth_models._user_has_perm(self, perm, obj)
def has_perm(self, perm, obj=None): """ Returns True if the user has the specified permission. This method queries all available auth backends, but returns immediately if any backend returns True. Thus, a user who has permission from a single auth backend is assumed to have permission in general. If an object is provided, permissions for this specific object are checked. """ # Active superusers have all permissions. if self.is_active and self.is_superuser: return True # Otherwise we need to check the backends. return auth._user_has_perm(self, perm, obj)
def has_perm(self, perm, obj=None): """ Returns True if the user has the specified permission. This method queries all available auth backends, but returns immediately if any backend returns True. Thus, a user who has permission from a single auth backend is assumed to have permission in general. If an object is provided, permissions for this specific object are checked. """ # Active superusers have all permissions. if self.is_active and self.is_superuser: return True # Otherwise we need to check the backends. return _user_has_perm(self, perm, obj)
def has_perm(self, perm, obj=None): """ Returns True if the user has the specified permission. This method queries all available auth backends, but returns immediately if any backend returns True. Thus, a user who has permission from a single auth backend is assumed to have permission in general. If an object is provided, permissions for this specific object are checked. This differs from the default in that superusers, while still having every permission, will be allowed after the logic has executed. This helps with typos in permission strings. """ has_perm = _user_has_perm(self, perm, obj) # Active superusers have all permissions. if self.is_active and self.is_superuser: return True else: return has_perm
def has_perm(self, perm, obj=None): if self.is_active and self.is_superuser: return True return _user_has_perm(self, perm, obj)
def has_terra_perm(self, codename): return _user_has_perm(self, f'{self._meta.app_label}.{codename}', None)
def user_has_perm(user, perm, obj): """ A backend can raise `PermissionDenied` to short-circuit permission checking. """ return _user_has_perm(user, perm, obj)
def has_perm(self, perm, obj=None): if self.is_superuser and self.activo: return True return _user_has_perm(self, perm, obj=obj)
def user_has_perm(self, perm, obj): return _user_has_perm(self, perm, obj)
def has_perm(self, perm, obj=None): # Не уволенные суперпользователи имеют весь доступ if not self.fired and self.is_superuser: return True return _user_has_perm(self, perm, obj)
def has_perm(self, perm, obj=None): return auth_models._user_has_perm(self, perm, obj=obj)
def has_perm(self, perm, obj=None): """Near complete coppy of the django.auth.contrib.models.User has_perm method.""" return _user_has_perm(self, perm, None)
def has_perm(self, perm, obj=None): return _user_has_perm(self, perm, obj=obj)
def user_has_perm(user, perm, obj): return _user_has_perm(user, perm, obj)
def has_edit_perm(self, perm, obj=None): if self.pk == obj.pk: return True return auth_models._user_has_perm(self, perm, obj)
def has_perm(self, perm, obj=None): if self.is_active and self.is_superuser: return True # Otherwise we need to check the backends. return _user_has_perm(self, perm, obj)
def has_perm(self, perm, obj=None): if self.is_active and self.is_superuser: return True return auth_models._user_has_perm(self, perm, obj)