Ntb\RestAPI\BaseRestController
Base class for the rest resource controllers.
- Author: Christian Blank <c.blank@notthatbad.net>
Synopsis
class BaseRestController
extends Controller
{
- // members
- private static array $allowed_actions = ;
- private static bool $https_only = true;
- // methods
- public void init()
- public null head()
- protected HTMLText|SS_HTTPResponse handleAction()
- private string getMethodName()
- protected bool isAuthenticated()
- protected bool isAdmin()
- protected SS_HTTPResponse addCORSHeaders()
- protected Member currentUser()
Hierarchy
Extends
- Controller
Tasks
Line | Task |
---|---|
165 | body could be an exception; check it before the response is generated |
Members
private
- $allowed_actions
- $https_only
—
Ntb\RestAPI\bool
Configuration option.
Methods
private
- getMethodName() — Returns the http method for this request. If the current environment is a development env, the method can be changed with a `method` variable.
protected
- addCORSHeaders()
- currentUser() — Return the current user from the request.
- handleAction() — handleAction implementation for rest controllers. This handles the requested action differently then the standard implementation.
- isAdmin() — Check if the user has admin privileges.
- isAuthenticated() — Check, if the request is authenticated.