PHP Class BookStack\Http\Controllers\Controller

Inheritance: extends Illuminate\Routing\Controller, use trait Illuminate\Foundation\Bus\DispatchesJobs, use trait Illuminate\Foundation\Validation\ValidatesRequests
Exibir arquivo Open project: ssddanbrown/bookstack Class Usage Examples

Protected Properties

Property Type Description
$currentUser static
$signedIn boolean

Public Methods

Method Description
__construct ( ) Controller constructor.
setPageTitle ( $title ) Adds the page title into the view.

Protected Methods

Method Description
buildFailedValidationResponse ( Illuminate\Http\Request $request, array $errors ) : Response Create the response for when a request fails validation.
checkOwnablePermission ( $permission, Ownable $ownable ) : boolean Check the current user's permissions against an ownable item.
checkPermission ( string $permissionName ) : boolean | Illuminate\Http\RedirectResponse Checks for a permission.
checkPermissionOr ( $permissionName, $callback ) : boolean Check if a user has a permission or bypass if the callback is true.
jsonError ( string $messageText = "", integer $statusCode = 500 ) : mixed Send back a json error message.
preventAccessForDemoUsers ( ) Stops the application and shows a permission error if the application is in demo mode.
showPermissionError ( ) On a permission error redirect to home and display.

Method Details

__construct() public method

Controller constructor.
public __construct ( )

buildFailedValidationResponse() protected method

Create the response for when a request fails validation.
protected buildFailedValidationResponse ( Illuminate\Http\Request $request, array $errors ) : Response
$request Illuminate\Http\Request
$errors array
return Symfony\Component\HttpFoundation\Response

checkOwnablePermission() protected method

Check the current user's permissions against an ownable item.
protected checkOwnablePermission ( $permission, Ownable $ownable ) : boolean
$permission
$ownable BookStack\Ownable
return boolean

checkPermission() protected method

Checks for a permission.
protected checkPermission ( string $permissionName ) : boolean | Illuminate\Http\RedirectResponse
$permissionName string
return boolean | Illuminate\Http\RedirectResponse

checkPermissionOr() protected method

Check if a user has a permission or bypass if the callback is true.
protected checkPermissionOr ( $permissionName, $callback ) : boolean
$permissionName
$callback
return boolean

jsonError() protected method

Send back a json error message.
protected jsonError ( string $messageText = "", integer $statusCode = 500 ) : mixed
$messageText string
$statusCode integer
return mixed

preventAccessForDemoUsers() protected method

Stops the application and shows a permission error if the application is in demo mode.

setPageTitle() public method

Adds the page title into the view.
public setPageTitle ( $title )
$title

showPermissionError() protected method

the error as a notification.
protected showPermissionError ( )

Property Details

$currentUser protected_oe property

static
protected $currentUser

$signedIn protected_oe property

protected bool $signedIn
return boolean