mirror of https://gitee.com/bigwinds/arangodb
Foxx: Added the same for onlyIf and onlyIfAuthenticated
This commit is contained in:
parent
3e033be395
commit
7a7d972069
|
@ -191,6 +191,14 @@ The following methods are available:
|
|||
|
||||
@copydetails JSF_foxx_RequestContextBuffer_errorResponse
|
||||
|
||||
### onlyIf
|
||||
|
||||
@copydetails JSF_foxx_RequestContextBuffer_onlyIf
|
||||
|
||||
### onlyIfAuthenticated
|
||||
|
||||
@copydetails JSF_foxx_RequestContextBuffer_onlyIfAuthenticated
|
||||
|
||||
Before and After Hooks
|
||||
----------------------
|
||||
|
||||
|
|
|
@ -389,7 +389,49 @@ _.each([
|
|||
/// });
|
||||
/// @endcode
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
"errorResponse"
|
||||
"errorResponse",
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @fn JSF_foxx_RequestContextBuffer_onlyIf
|
||||
/// @brief Defines a controller-wide onlyIf
|
||||
///
|
||||
/// @FUN{RequestContextBuffer::onlyIf(@FA{code}, @FA{reason})}
|
||||
///
|
||||
/// Defines an `onlyIf` for all routes of this controller. For details on
|
||||
/// `onlyIf` see the according method on routes.
|
||||
///
|
||||
/// @EXAMPLES
|
||||
///
|
||||
/// @code
|
||||
/// app.allroutes.onlyIf(myPersonalCheck);
|
||||
///
|
||||
/// app.get("/foxx", function {
|
||||
/// // Do something
|
||||
/// });
|
||||
/// @endcode
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
"onlyIf",
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @fn JSF_foxx_RequestContextBuffer_onlyIfAuthenticated
|
||||
/// @brief Defines a controller-wide onlyIfAuthenticated
|
||||
///
|
||||
/// @FUN{RequestContextBuffer::errorResponse(@FA{errorClass}, @FA{code}, @FA{description})}
|
||||
///
|
||||
/// Defines an `onlyIfAuthenticated` for all routes of this controller. For details on
|
||||
/// `onlyIfAuthenticated` see the according method on routes.
|
||||
///
|
||||
/// @EXAMPLES
|
||||
///
|
||||
/// @code
|
||||
/// app.allroutes.onlyIfAuthenticated(401, "You need to be authenticated");
|
||||
///
|
||||
/// app.get("/foxx", function {
|
||||
/// // Do something
|
||||
/// });
|
||||
/// @endcode
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
"onlyIfAuthenticated"
|
||||
], function(functionName) {
|
||||
extend(RequestContextBuffer.prototype[functionName] = function () {
|
||||
this.applyChain.push({
|
||||
|
|
Loading…
Reference in New Issue