Welcome Guest, Not a member yet? Register   Sign In
REST
#1

(This post was last modified: 06-20-2017, 02:04 AM by ciadmin. Edit Reason: SEO spam link removed )

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
Reply
#2

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(); 
Reply
#3

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
Reply




Theme © iAndrew 2016 - Forum software by © MyBB