⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

Login Screen



php_lover

php_lover
  • profile picture
  • Member

Posted 15 February 2013 - 08:48 AM

I want to divide my users in differennt classes so i have to make login screen for grocery crud
I want to assign different privelege to different users

For Eg:

User A: Add Data,Delete Data,Edit Data

User B:Only Edit Data

User C: only View Data

User D: only edit data

How can i do this Kindly help me

 


oVERDRIVE

oVERDRIVE
  • profile picture
  • Member

Posted 15 February 2013 - 09:52 AM

I take the user_id and group_id from the session, and in the controller use some library that manage the right access and operation ...


victor

victor
  • profile picture
  • Member

Posted 15 February 2013 - 10:01 AM

if($_USER_DATA["ROLE"]=="ADMIN"){all right} elseif($_USER_DATA["ROLE"]!="ADMIN" .....){$crud->unset_edit()}

php_lover

php_lover
  • profile picture
  • Member

Posted 15 February 2013 - 10:19 AM

Thanks Victor I know u make my life easy thanks
Thanks oVerDRIVE too


davidoster

davidoster
  • profile picture
  • Member

Posted 15 February 2013 - 12:10 PM

If you use the ion_auth library it has a builtin table of user_groups.

There you create your groups.

Then you create on more table called group_priviledges.

group_priviledges table has id, group_id, description [even a url, or function name] as a list of all the available priviledges.

Then you assign your users to groups.

And you get (via your model) a true false value if the current operation(make an add/delete/update, redirect to x url, or call y function) is allowed for this user(group).

 

You make the system once and then you forget it for ever.

And you have a nice grocery crud interface to add/update all these data!


php_lover

php_lover
  • profile picture
  • Member

Posted 16 February 2013 - 07:37 AM

Bundle of Thanks David Oster