logan871 Posted August 8, 2015 Share Posted August 8, 2015 (edited) Hi, I need to grant access to module front controller ajax actions only to logged in employee. how to do it? I've tried with: $context = Context::getContext(); $context->employee->isLoggedBack(); But employee is always NULL. Edited August 31, 2015 by logan871 (see edit history) 1 Link to comment Share on other sites More sharing options...
logan871 Posted August 9, 2015 Author Share Posted August 9, 2015 up Link to comment Share on other sites More sharing options...
Nishith Nesdiya Posted August 10, 2015 Share Posted August 10, 2015 (edited) hello you can check the this way$context = Context::getContext(); $login = $this->context->customer->isLogged() if($login) { //your code here } Edited August 10, 2015 by Nishith (see edit history) Link to comment Share on other sites More sharing options...
logan871 Posted August 10, 2015 Author Share Posted August 10, 2015 (edited) Thanks for reply but I need authorization for employee not for customer. But I'm not in admin context so I cannot access to employee informations. Is there any to access to authenticated employee data from module front controller in ajax action? Or I should 'convert' module front controller in an admin module controller? How to create link to admin module controller action? There are conventions for ajax action name in module admin controller and for the name of controller itself (ajaxProcessSomeAction)? Can I create an admin module controller just for process some ajax request restricting access just to authenticated employee (no guest or customer)? Edited August 10, 2015 by logan871 (see edit history) Link to comment Share on other sites More sharing options...
logan871 Posted August 11, 2015 Author Share Posted August 11, 2015 up Link to comment Share on other sites More sharing options...
Nishith Nesdiya Posted August 11, 2015 Share Posted August 11, 2015 (edited) hi... please check with this code $cookie = new Cookie('psAdmin'); $id_employee = $cookie->id_employee; $profile = $cookie->profile; echo $id_employee; echo $profile; die(); Edited August 11, 2015 by Nishith (see edit history) 1 Link to comment Share on other sites More sharing options...
logan871 Posted August 12, 2015 Author Share Posted August 12, 2015 thank you, it works! Link to comment Share on other sites More sharing options...
Nishith Nesdiya Posted August 12, 2015 Share Posted August 12, 2015 you most welcome..please modify the title [solved] your title thanks. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now