2
votes

I'm currently using CodeIgniter with MySQL, in my application I'm setting a MySQL variable to limit access to data for certain users within VIEWS, (i.e. SET @UserID = 2; which runs when the user logs in) this is then referenced in my views to ensure data returned is limited (I'm also using Active Record for pass in the ID in queries - I'm keen to have multiple access controls).

The above is working great in testing so far, I was just keen to confirm that this is a suitable approach with CodeIgniter, i.e. each page load with multiple SQL queries across models/controllers will be on a single unshared connection (not with other concurrent users who will set their own UserID)? Given pconnect is disabled I'm assuming this is the case.

Thanks in advance

1
This should be OK, but I don't know why you're not using a normal 'where' statement that you pass through your query (what's the advantage?) - ahmad

1 Answers

0
votes

in my advice you should use ion_auth library In which you can make group such as admin,sub admin,staffand give them access as you want by checking their group_id in controller and you can also manage their other details also.