REST - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: REST (/showthread.php?tid=68283) |
REST - jms - 06-20-2017 Hi I want to use Rest_controler to make RESTfull api, but I have problem how can I make user perm to resources. For example users/users (GET users list only for admin group users) but users/user/id/10 (GET user for admin group user but for user with ID=10 too) I think about constructor in REST_Controller and ion_auth - check user and redirect to proper method of controller or send 401 error to user, but where is information about user from HTTP auth? best regards Jurek RE: REST - PaulD - 06-20-2017 Ion_auth is pretty well documented, but here is the example to get user data from a logged in user. PHP Code: $user = $this->ion_auth->user(); or PHP Code: $user = $this->ion_auth->user()->row(); RE: REST - jms - 06-20-2017 Thx for your answer, but I have problem with get user name from incomig HTTP packet with basic or digest auth. I want to get user name in order to check user privilages Regards Jurek |