Mixin: WithAuthorization

Defined in: src/mixin/withAuthorization.coffee

Overview

Allows classes to request authorization to perform actions. Requires the {Observable Observable} mixin.

Method Summary

Method Details

? (void) withAuthorization(params)

Require authorization for a given action. Notifies observers to the requiresAuthorization event, passing an action callback which the observer can either call (if authorized), store, or ignore, and a deferred, which completion of the callback will resolve. The deferred may be rejected by the handling observer; its promise is the return value of {#withAuthorization}.

Examples:

@withAuthorization: action: => @save()

Parameters:

  • params (Object) Parameters passed to the method

Options Hash: (param):

  • deferred (Object) Optional; a deferred, resolving when the action is complete
  • action (Function) The action to be taken if authorization is given