Changeset 65 for trunk/dns.sql


Ignore:
Timestamp:
11/25/10 16:26:08 (13 years ago)
Author:
Kris Deugau
Message:

/trunk

checkpoint, adding permissions/ACL support

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dns.sql

    r50 r65  
    77
    88-- tabledefs and preloaded data bits
     9CREATE TABLE permissions (
     10    permission_id SERIAL NOT NULL,
     11    admin boolean DEFAULT 'n' NOT NULL,
     12    self_edit boolean DEFAULT 'n' NOT NULL,
     13    group_create boolean DEFAULT 'n' NOT NULL,
     14    group_edit boolean DEFAULT 'n' NOT NULL,
     15    group_delete boolean DEFAULT 'n' NOT NULL,
     16    user_create boolean DEFAULT 'n' NOT NULL,
     17    user_edit boolean DEFAULT 'n' NOT NULL,
     18    user_delete boolean DEFAULT 'n' NOT NULL,
     19    domain_create boolean DEFAULT 'n' NOT NULL,
     20    domain_edit boolean DEFAULT 'n' NOT NULL,
     21    domain_delete boolean DEFAULT 'n' NOT NULL,
     22    record_create boolean DEFAULT 'n' NOT NULL,
     23    record_edit boolean DEFAULT 'n' NOT NULL,
     24    record_delete boolean DEFAULT 'n' NOT NULL
     25);
     26
     27-- Need *two* basic permissions;  one for the initial group, one for the default admin user
     28COPY permissions (permission_id, admin, self_edit, group_create, group_edit group_delete, user_create, user_edit, user_delete, domain_create, domain_edit, domain_delete, record_create, record_edit, record_delete) FROM stdin;
     291       n       n       n       n       n       n       n       n       n       n       n       n       n       n
     302       y       n       n       n       n       n       n       n       n       n       n       n       n       n
     31\.
     32
    933CREATE TABLE groups (
    1034    group_id serial NOT NULL,
    1135    parent_group_id integer DEFAULT 1 NOT NULL,
     36    permission_id integer DEFAULT 1 NOT NULL,
    1237    group_name character varying(255) DEFAULT ''::character varying NOT NULL
    1338);
     
    1540-- Provide a basic default group
    1641COPY groups (group_id, parent_group_id, group_name) FROM stdin;
    17 1       1       default
     421       1       1       default
    1843\.
    1944
     
    151176    "type" character(1) DEFAULT 'S'::bpchar NOT NULL,
    152177    status integer DEFAULT 1 NOT NULL,
    153     acl character varying(40) DEFAULT 'b'::character varying NOT NULL
     178    acl character varying(40) DEFAULT 'b'::character varying NOT NULL,
     179    permission_id DEFAULT 1 NOT NULL,
    154180);
    155181
    156182-- create initial default user?  may be better to create an "initialize" script or something
    157183COPY users (user_id, group_id, username, "password", firstname, lastname, phone, "type", status, acl) FROM stdin;
    158 1       1       test@test       $1$BByge8u2$48AaGX3YeHplfErX5Tlqa1      \N      \N      \N      S       1       A
     1841       1       test@test       $1$BByge8u2$48AaGX3YeHplfErX5Tlqa1      \N      \N      \N      S       1       A       2
    159185\.
    160186
     
    174200
    175201-- primary keys
     202ALTER TABLE ONLY permissions
     203    ADD CONSTRAINT permissions_permission_id_key UNIQUE (permission_id);
     204
    176205ALTER TABLE ONLY groups
    177206    ADD CONSTRAINT groups_group_id_key UNIQUE (group_id);
     
    199228
    200229-- foreign keys
     230-- fixme: permissions FK refs
    201231ALTER TABLE ONLY domains
    202232    ADD CONSTRAINT "$1" FOREIGN KEY (group_id) REFERENCES groups(group_id);
     
    216246-- set sequence start values - make sure we don't screw up adding
    217247-- records to tables that already have a few entries
     248SELECT pg_catalog.setval('permissions_permission_id_seq', 2, true);
    218249
    219250SELECT pg_catalog.setval('groups_group_id_seq', 52, true);
Note: See TracChangeset for help on using the changeset viewer.