Example #1
0
        def decorator(f):
            element = self._navigation_item(
                bake_endpoint(self.blueprint, f),
                text,
                description)

            self._elements.append(element)
            return f
Example #2
0
        def decorator(f):
            element = self._navigation_item(
                bake_endpoint(self.blueprint, f),
                text,
                description)

            self._elements.append(element)
            return f
Example #3
0
 def decorator(f):
     self._elements.append(
         NavigationItem(endpoint=bake_endpoint(self.blueprint, f),
                        text=text,
                        description=description,
                        icon=icon,
                        weight=weight))
     self._elements.sort(key=lambda entry: entry.weight)
     # TODO: Sort this list
     return f
Example #4
0
 def decorator(fn):
     if len(needed_permissions):
         endpoint = bake_endpoint(self.blueprint, fn)
         self._restrictions[endpoint] = tuple(needed_permissions)
     @wraps(fn)
     def nufun(*args, **kwargs):
         if not current_user.is_authenticated():
             return current_app.login_manager.unauthorized()
         if self._current_has_access(needed_permissions):
             return fn(*args, **kwargs)
         abort(401)
     return nufun
Example #5
0
        def decorator(fn):
            if len(needed_permissions):
                endpoint = bake_endpoint(self.blueprint, fn)
                self._restrictions[endpoint] = tuple(needed_permissions)

            @wraps(fn)
            def nufun(*args, **kwargs):
                if not current_user.is_authenticated():
                    return current_app.login_manager.unauthorized()
                if self._current_has_access(needed_permissions):
                    return fn(*args, **kwargs)
                abort(401)

            return nufun
Example #6
0
 def decorator(f):
     endpoint = bake_endpoint(self.blueprint, f)
     self.endpoint_properties_map[endpoint] = view_properties
     f.required_properties = view_properties
     return f