CodeIgniter Forums

Full Version: session w/ user roles
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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.
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;
ion auth: https://github.com/benedmunds/CodeIgniter-Ion-Auth
docs: http://benedmunds.com/ion_auth/
author ben edmunds is on the codeigniter council
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-w...h-and-ci3/
Thanks for that. I will give it a shot when I get home.