code: def has_permission(cls, user):
          
          # no login is needed, so its always fine
          if not cls.requires_login:
              return True
  
          # if user is somehow not logged in
          if not user.is_authenticated:
              return False
  
          # attribute permission_required is mandatory, returns tuple
          perms = cls.get_permission_required()
          # if perms are defined and empty, we skip checking
          if not perms:
              return True
  
          # get role of user, skip admin role
          role = user.urole.role.name
          if role == cls.ADMIN:
              return True
  
          # check if at least one permissions is valid
          for permission in perms:
              if cls.check_permission(role, permission):
                  return True
  
          # permission denied
          return False
docs: We override this method to customize the way permissions are checked.
          Using our roles to check permissions.