Delete
Setting
Add New Item
Menu List
Title | Content Type | Order | Action | ||||||
---|---|---|---|---|---|---|---|---|---|
{{kb_content.name}} {{kb_content.name}} | {{setValue(content_types, kb_content.content_type)}} | {{kb_content.sort_order}} | Preview Edit Edit Content | ||||||
{{kb_content.name}} | {{setValue(content_types, kb_content.content_type)}} | {{kb_content.sort_order}} | Preview Edit Edit Content | ||||||
No record |
Step 3: Set authentication for action or controller
This is complete tutorial to build an application using grails 3.x. There are several parts of tutorial where every part has a specific objective and several steps. So it is a step by step tutorial to build a complete application using grails 3.x.
You can set authentication in route for specific action as bellows
Route::get('profile', function () { // Only authenticated users may enter... })->middleware('auth');
Of course, if you are using controllers, you may call the middleware method from the controller's constructor instead of attaching it in the route definition directly:
public function __construct()
{
$this->middleware('auth');
}
Still now, contact all action is public and accessible without login. We want to set authentication for all action contact list, edit, delete except create just updating contact controller which is as bellow:
public function __construct() {
$currentAction = Route::getCurrentRoute()->getName();
if ($currentAction == 'contact.create' || $currentAction == 'contact.store') {
} else {
$this->middleware('auth');
}
}