Skip to content

Instantly share code, notes, and snippets.

@jhuriez
Created June 13, 2013 07:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jhuriez/5771810 to your computer and use it in GitHub Desktop.
Save jhuriez/5771810 to your computer and use it in GitHub Desktop.
Dump sql for Fuelphp Ormauth
-- phpMyAdmin SQL Dump
-- version 3.5.1
-- http://www.phpmyadmin.net
--
-- Client: localhost
-- Généré le: Jeu 13 Juin 2013 à 07:19
-- Version du serveur: 5.5.24-log
-- Version de PHP: 5.4.3
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
--
-- Base de données: `test_fuelstarter`
--
-- --------------------------------------------------------
--
-- Structure de la table `migration`
--
CREATE TABLE IF NOT EXISTS `migration` (
`type` varchar(25) NOT NULL,
`name` varchar(50) NOT NULL,
`migration` varchar(100) NOT NULL DEFAULT ''
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Contenu de la table `migration`
--
INSERT INTO `migration` (`type`, `name`, `migration`) VALUES
('package', 'auth', '001_auth_create_usertables'),
('package', 'auth', '002_auth_create_grouptables'),
('package', 'auth', '003_auth_create_roletables'),
('package', 'auth', '004_auth_create_permissiontables'),
('package', 'auth', '005_auth_create_authdefaults'),
('package', 'auth', '006_auth_add_authactions'),
('package', 'auth', '007_auth_add_permissionsfilter'),
('package', 'auth', '008_auth_create_providers'),
('package', 'auth', '009_auth_create_oauth2tables');
-- --------------------------------------------------------
--
-- Structure de la table `users`
--
CREATE TABLE IF NOT EXISTS `users` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`username` varchar(50) NOT NULL,
`password` varchar(255) NOT NULL,
`group_id` int(11) NOT NULL DEFAULT '1',
`email` varchar(255) NOT NULL,
`last_login` varchar(25) NOT NULL,
`previous_login` varchar(25) NOT NULL DEFAULT '0',
`login_hash` varchar(255) NOT NULL,
`user_id` int(11) NOT NULL DEFAULT '0',
`created_at` int(11) NOT NULL DEFAULT '0',
`updated_at` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
UNIQUE KEY `username` (`username`,`email`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=3 ;
--
-- Contenu de la table `users`
--
INSERT INTO `users` (`id`, `username`, `password`, `group_id`, `email`, `last_login`, `previous_login`, `login_hash`, `user_id`, `created_at`, `updated_at`) VALUES
(0, 'guest', 'YOU CAN NOT USE THIS TO LOGIN', 2, '', '0', '0', '', 0, 0, 0),
(2, 'admin', 'YWqmPGH+dOEvOh6pf83a62lzJ1QQLHRMPHhNIaohB3s=', 6, 'admin@example.org', '1371107779', '1371107495', 'ce8199e9c119f4f6dae6ed84b8744de0b7e82c8f', 2, 1371107321, 1371107779);
-- --------------------------------------------------------
--
-- Structure de la table `users_clients`
--
CREATE TABLE IF NOT EXISTS `users_clients` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(32) NOT NULL DEFAULT '',
`client_id` varchar(32) NOT NULL DEFAULT '',
`client_secret` varchar(32) NOT NULL DEFAULT '',
`redirect_uri` varchar(255) NOT NULL DEFAULT '',
`auto_approve` tinyint(1) NOT NULL DEFAULT '0',
`autonomous` tinyint(1) NOT NULL DEFAULT '0',
`status` enum('development','pending','approved','rejected') NOT NULL DEFAULT 'development',
`suspended` tinyint(1) NOT NULL DEFAULT '0',
`notes` tinytext NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `client_id` (`client_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Structure de la table `users_groups`
--
CREATE TABLE IF NOT EXISTS `users_groups` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL,
`user_id` int(11) NOT NULL DEFAULT '0',
`created_at` int(11) NOT NULL DEFAULT '0',
`updated_at` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=7 ;
--
-- Contenu de la table `users_groups`
--
INSERT INTO `users_groups` (`id`, `name`, `user_id`, `created_at`, `updated_at`) VALUES
(1, 'Banned', 0, 0, 0),
(2, 'Guests', 0, 0, 0),
(3, 'Users', 0, 0, 0),
(4, 'Moderators', 0, 0, 0),
(5, 'Administrators', 0, 0, 0),
(6, 'Super Admins', 0, 0, 0);
-- --------------------------------------------------------
--
-- Structure de la table `users_group_permissions`
--
CREATE TABLE IF NOT EXISTS `users_group_permissions` (
`group_id` int(11) NOT NULL,
`perms_id` int(11) NOT NULL,
`actions` text,
PRIMARY KEY (`group_id`,`perms_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Structure de la table `users_group_roles`
--
CREATE TABLE IF NOT EXISTS `users_group_roles` (
`group_id` int(11) NOT NULL,
`role_id` int(11) NOT NULL,
PRIMARY KEY (`group_id`,`role_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Contenu de la table `users_group_roles`
--
INSERT INTO `users_group_roles` (`group_id`, `role_id`) VALUES
(1, 1),
(2, 2),
(3, 3),
(4, 3),
(4, 4),
(5, 3),
(5, 4),
(5, 5),
(6, 6);
-- --------------------------------------------------------
--
-- Structure de la table `users_metadata`
--
CREATE TABLE IF NOT EXISTS `users_metadata` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`parent_id` int(11) NOT NULL DEFAULT '0',
`key` varchar(20) NOT NULL,
`value` varchar(100) NOT NULL,
`user_id` int(11) NOT NULL DEFAULT '0',
`created_at` int(11) NOT NULL DEFAULT '0',
`updated_at` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=3 ;
--
-- Contenu de la table `users_metadata`
--
INSERT INTO `users_metadata` (`id`, `parent_id`, `key`, `value`, `user_id`, `created_at`, `updated_at`) VALUES
(1, 0, 'fullname', 'Guest', 0, 0, 0),
(2, 2, 'fullname', 'System administrator', 0, 1371107321, 0);
-- --------------------------------------------------------
--
-- Structure de la table `users_permissions`
--
CREATE TABLE IF NOT EXISTS `users_permissions` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`area` varchar(25) NOT NULL,
`permission` varchar(25) NOT NULL,
`description` varchar(255) NOT NULL,
`actions` text,
`user_id` int(11) NOT NULL DEFAULT '0',
`created_at` int(11) NOT NULL DEFAULT '0',
`updated_at` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
UNIQUE KEY `permission` (`area`,`permission`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ;
--
-- Contenu de la table `users_permissions`
--
INSERT INTO `users_permissions` (`id`, `area`, `permission`, `description`, `actions`, `user_id`, `created_at`, `updated_at`) VALUES
(1, 'backend', 'page', '', '', 0, 0, 0);
-- --------------------------------------------------------
--
-- Structure de la table `users_providers`
--
CREATE TABLE IF NOT EXISTS `users_providers` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`parent_id` int(11) NOT NULL DEFAULT '0',
`provider` varchar(50) NOT NULL,
`uid` varchar(255) NOT NULL,
`secret` varchar(255) DEFAULT NULL,
`access_token` varchar(255) DEFAULT NULL,
`expires` int(12) DEFAULT '0',
`refresh_token` varchar(255) DEFAULT NULL,
`user_id` int(11) NOT NULL DEFAULT '0',
`created_at` int(11) NOT NULL DEFAULT '0',
`updated_at` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
KEY `parent_id` (`parent_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Structure de la table `users_roles`
--
CREATE TABLE IF NOT EXISTS `users_roles` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL,
`filter` enum('','A','D','R') NOT NULL DEFAULT '',
`user_id` int(11) NOT NULL DEFAULT '0',
`created_at` int(11) NOT NULL DEFAULT '0',
`updated_at` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=7 ;
--
-- Contenu de la table `users_roles`
--
INSERT INTO `users_roles` (`id`, `name`, `filter`, `user_id`, `created_at`, `updated_at`) VALUES
(1, 'banned', 'D', 0, 0, 0),
(2, 'public', '', 0, 0, 0),
(3, 'user', '', 0, 0, 0),
(4, 'moderator', '', 0, 0, 0),
(5, 'administrator', '', 0, 0, 0),
(6, 'superadmin', 'A', 0, 0, 0);
-- --------------------------------------------------------
--
-- Structure de la table `users_role_permissions`
--
CREATE TABLE IF NOT EXISTS `users_role_permissions` (
`role_id` int(11) NOT NULL,
`perms_id` int(11) NOT NULL,
`actions` text,
PRIMARY KEY (`role_id`,`perms_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Structure de la table `users_scopes`
--
CREATE TABLE IF NOT EXISTS `users_scopes` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`scope` varchar(64) NOT NULL DEFAULT '',
`name` varchar(64) NOT NULL DEFAULT '',
`description` varchar(255) NOT NULL DEFAULT '',
PRIMARY KEY (`id`),
UNIQUE KEY `scope` (`scope`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Structure de la table `users_sessions`
--
CREATE TABLE IF NOT EXISTS `users_sessions` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`client_id` varchar(32) NOT NULL DEFAULT '',
`redirect_uri` varchar(255) NOT NULL DEFAULT '',
`type_id` varchar(64) NOT NULL,
`type` enum('user','auto') NOT NULL DEFAULT 'user',
`code` text NOT NULL,
`access_token` varchar(50) NOT NULL DEFAULT '',
`stage` enum('request','granted') NOT NULL DEFAULT 'request',
`first_requested` int(11) NOT NULL,
`last_updated` int(11) NOT NULL,
`limited_access` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
KEY `oauth_sessions_ibfk_1` (`client_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Structure de la table `users_sessionscopes`
--
CREATE TABLE IF NOT EXISTS `users_sessionscopes` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`session_id` int(11) NOT NULL,
`access_token` varchar(50) NOT NULL DEFAULT '',
`scope` varchar(64) NOT NULL DEFAULT '',
PRIMARY KEY (`id`),
KEY `session_id` (`session_id`),
KEY `access_token` (`access_token`),
KEY `scope` (`scope`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Structure de la table `users_user_permissions`
--
CREATE TABLE IF NOT EXISTS `users_user_permissions` (
`user_id` int(11) NOT NULL,
`perms_id` int(11) NOT NULL,
`actions` text,
PRIMARY KEY (`user_id`,`perms_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Contenu de la table `users_user_permissions`
--
INSERT INTO `users_user_permissions` (`user_id`, `perms_id`, `actions`) VALUES
(2, 1, 'a:1:{i:0;s:4:"read";}');
-- --------------------------------------------------------
--
-- Structure de la table `users_user_roles`
--
CREATE TABLE IF NOT EXISTS `users_user_roles` (
`user_id` int(11) NOT NULL,
`role_id` int(11) NOT NULL,
PRIMARY KEY (`user_id`,`role_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Contraintes pour les tables exportées
--
--
-- Contraintes pour la table `users_sessions`
--
ALTER TABLE `users_sessions`
ADD CONSTRAINT `oauth_sessions_ibfk_1` FOREIGN KEY (`client_id`) REFERENCES `users_clients` (`client_id`) ON DELETE CASCADE;
--
-- Contraintes pour la table `users_sessionscopes`
--
ALTER TABLE `users_sessionscopes`
ADD CONSTRAINT `oauth_sessionscopes_ibfk_1` FOREIGN KEY (`scope`) REFERENCES `users_scopes` (`scope`),
ADD CONSTRAINT `oauth_sessionscopes_ibfk_2` FOREIGN KEY (`session_id`) REFERENCES `users_sessions` (`id`) ON DELETE CASCADE;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
@faycal1
Copy link

faycal1 commented Sep 19, 2013

Hi jhuriez ,

I try to understand the Fuelphp Ormauth with permission but no success , can you please provide me an example how to fill the datatables permission in relation with users or roles or groups ; thanx in advence

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment