def require(self, users=(), roles=(), test_auth=None, test_method=None):

        users = self._process_targets(users)
        roles = self._process_targets(roles)

        def loaded_decorated(f):
            @wraps(f)
            def decorated(*args, **kwargs):
                auth = test_auth or request.authorization
                method = test_method.upper() if test_method else request.method
                authenticated = auth and (auth.username in self.users) and \
                    self.users[auth.username] == auth.password
                if not authenticated:
                    return self.no_authentication()
                allowed_users = users[method] if users else None
                allowed_roles = roles[method] if roles else None
                if allowed_users or allowed_roles:
                    auth_as_user = auth.username in allowed_users
                    auth_as_role = allowed_roles & self.roles[auth.username]
                    if not auth_as_user and not auth_as_role:
                        return self.no_authorization()
                return f(*args, **kwargs)
            return decorated
        return loaded_decorated
Creates an instance.
dataset/ETHPy150Open ownaginatious/flask-basic-roles/flask_basic_roles/__init__.py/BasicRoleAuth.require--crossover with--dataset/ETHPy150Open rtyler/Spawning/spawning/spawning_child.py/URLInterceptor.__init__