code: def need_record_permission(factory_name):
      
      def need_record_permission_builder(f):
          @wraps(f)
          def need_record_permission_decorator(self, record=None, *args,
                                               **kwargs):
              permission_factory = (
                  getattr(self, factory_name) or
                  getattr(current_records_rest, factory_name)
              )
  
              # FIXME use context instead
              request._methodview = self
  
              if permission_factory:
                  verify_record_permission(permission_factory, record)
              return f(self, record=record, *args, **kwargs)
          return need_record_permission_decorator
      return need_record_permission_builder
docs: Decorator checking that the user has the required permissions on record.
  
      :param factory_name: name of the permission factory.