Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

A simple user management library. Mainly contains a simple user model and a couple of DAOs. Current implementations are hibernate-based. Was started long ago, then re-used once I got disapointed with osuser. Still has a couple of old classes or ideas here and there, needs clean up and polishing.

The current db schema can be created as follows:

  • create a database called swaf (or other if you want, you'll have to update your jndi configuration accordingly)
  • create a user for swaf and give it the right permissions.
    On mysql, this can be done with the following script:
    create database swaf;
    grant all privileges on swaf.* to 'swaf'@'localhost' identified by 'swaf';
    
  • create the schema itself, using the following script:
    use swaf;
    
    create table user (
       user_id bigint not null auto_increment,
       password varchar(255) not null,
       user_name varchar(32) not null,
       email varchar(128),
       full_name varchar(128),
       primary key (user_id)
    );
    create table group_role (
       group_id bigint not null,
       role varchar(255) not null,
       primary key (group_id, role)
    );
    create table group_properties (
       group_id bigint not null,
       value text,
       name varchar(255) not null,
       primary key (group_id, name)
    );
    create table `group` (
       group_id bigint not null auto_increment,
       group_name varchar(32) not null unique,
       primary key (group_id)
    );
    create table user_properties (
       user_id bigint not null,
       value text,
       name varchar(255) not null,
       primary key (user_id, name)
    );
    create table role (
       name varchar(255) not null,
       primary key (name)
    );
    create table user_group (
       group_id bigint not null,
       user_id bigint not null,
       primary key (user_id, group_id)
    );
    alter table group_role 
      add index FK4C707A36358076 (role), 
      add constraint FK4C707A36358076 foreign key (role) references role (name);
    alter table group_role
      add index FK4C707A361E2E76DB (group_id), 
      add constraint FK4C707A361E2E76DB foreign key (group_id) references `group` (group_id);
    alter table group_properties 
      add index FK1DD636F31E2E76DB (group_id), 
      add constraint FK1DD636F31E2E76DB foreign key (group_id) references `group` (group_id);
    alter table user_properties
      add index FK18623A27F73AEE0F (user_id), 
      add constraint FK18623A27F73AEE0F foreign key (user_id) references user (user_id);
    alter table user_group
      add index FK72A9010B1E2E76DB (group_id), 
      add constraint FK72A9010B1E2E76DB foreign key (group_id) references `group` (group_id);
    alter table user_group
      add index FK72A9010BF73AEE0F (user_id), 
      add constraint FK72A9010BF73AEE0F foreign key (user_id) references user (user_id);
    
  • No labels