def permissions_required(permissions, login_url=None):
 if (login_url is None):
  login_url = reverse_lazy('customer:login')
 def _check_permissions(user):
  outcome = check_permissions(user, permissions)
  if ((not outcome) and user.is_authenticated()):
   raise PermissionDenied
  else:
   return outcome
 return user_passes_test(_check_permissions, login_url=login_url)

def permissions_required ( permissions , login_url = None ) : if ( login_url is None ) : login_url = reverse_lazy ( 'customer:login' ) def _check_permissions ( user ) : outcome = check_permissions ( user , permissions ) if ( ( not outcome ) and user . is_authenticated ( ) ) : raise PermissionDenied else : return outcome return user_passes_test ( _check_permissions , login_url = login_url )
decorator that checks if a user has the given permissions .