Check user login and has permission
I want to check in each controller
--is login required or not
--is user logged in or not
--is has permission for the requested controller method.
Actually I want to make controller permission system.
how it is possible.
Please help me.
Comments
if i user
Class ufcm extends Fuel_base_controller{
}
then i is
Fatal error: Class 'fuel_base_controller' not found in \xampp\htdocs\ufcm\fuel\modules\ufcm\controllers\ufcm.php on line 3
MORE IMPORTANT
I want to use login and permission checker in pre_controller hook CI function. SO please tell me how can i do that
require_once(FUEL_PATH.'libraries/Fuel_base_controller.php');
To add a hook, you can add to the fuel/application/config/hooks.php file like any other CI hook.
after a long vacation I have come back.
I used your code, its working. I need to know that
How to set access permission like model page access permission ?
http://docs.getfuelcms.com/modules/generate
If you don't use the generate tool, in 1.0 you normally create 5 different permissions. An overall permission, one for create, one for edit, one for publish and another for delete. Below is a SQL insert as an example. This can all be done with the permissions module and there are checkboxes to automatically generate those additional create, edit, publish and delete permissions.
INSERT INTO `fuel_permissions` (`id`, `description`, `name`, `active`)
VALUES
(NULL, 'Events', 'events', 'yes'),
(NULL, 'Events: Create', 'events/create', 'yes'),
(NULL, 'Events: Edit', 'events/edit', 'yes'),
(NULL, 'Events: Publish', 'events/publish', 'yes'),
(NULL, 'Events: Delete', 'events/delete', 'yes');