CodeIgniter Forums
session w/ user roles - 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: session w/ user roles (/showthread.php?tid=63424)



session w/ user roles - ryan - 10-28-2015

Databases are not my thing... I mean I just don't get them. That being said, I have used codeigniter a while ago w/ grocery crud to try to learn this stuff and made something that worked but didn't touch it for a while and forgot everything. What I am trying to build is a log in with sessions where I can assign user rights based on roles. Do any of you know of any tutorials, pluggins, scripts or anything that would help me create this environment? I have found examples of sessions but roles are evading me.


RE: session w/ user roles - ignitedcms - 10-28-2015

The basic data structure for permissions is

Code:
#
# TABLE STRUCTURE FOR: permission_groups
#

DROP TABLE IF EXISTS `permission_groups`;

CREATE TABLE `permission_groups` (
  `groupID` int(11) NOT NULL AUTO_INCREMENT,
  `groupName` varchar(200) DEFAULT NULL,
  PRIMARY KEY (`groupID`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=latin1;



#
# TABLE STRUCTURE FOR: permission_map
#

DROP TABLE IF EXISTS `permission_map`;

CREATE TABLE `permission_map` (
  `groupID` int(11) NOT NULL DEFAULT '0',
  `permissionID` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`groupID`,`permissionID`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;



#
# TABLE STRUCTURE FOR: permissions
#

DROP TABLE IF EXISTS `permissions`;

CREATE TABLE `permissions` (
  `permissionID` int(11) NOT NULL AUTO_INCREMENT,
  `permission` varchar(200) DEFAULT NULL,
  `order_position` int(11) NOT NULL,
  PRIMARY KEY (`permissionID`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=latin1;



RE: session w/ user roles - cartalot - 10-28-2015

ion auth: https://github.com/benedmunds/CodeIgniter-Ion-Auth
docs: http://benedmunds.com/ion_auth/
author ben edmunds is on the codeigniter council


RE: session w/ user roles - cartalot - 10-28-2015

ha thats funny -- this tutorial for ion auth was just posted by Avenirer a few hours ago, looks pretty cool

http://avenir.ro/authentication-system-with-ion-auth-and-ci3/


RE: session w/ user roles - ryan - 10-28-2015

Thanks for that. I will give it a shot when I get home.