Changeset 3217


Ignore:
Timestamp:
07/31/13 16:15:15 (11 years ago)
Author:
olhsha
Message:

changing handling permissions: adding a 1 column table with all possible permission values, so far only 3 of them

Location:
DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/main/sql/DashishAnnotatorCreate.sql

    r3216 r3217  
    162162
    163163
    164 
    165 -----------------------------------------------------------------------
    166 --------------------- JOINT TABLES ------------------------------------
    167 
    168 CREATE TABLE annotations_target_sources (
    169    annotation_id integer REFERENCES annotation(annotation_id), -- defining a foreign key: there must be a uniquely defined row in "annotation", that is defined by "annotation_id"
    170    source_id integer REFERENCES target_source(source_id),
    171    unique(annotation_id, source_id),
    172 );
    173 
    174 
    175 
    176 CREATE TABLE notebooks_annotations (
    177     notebook_id integer REFERENCES notebook(notebook_id),
    178     annotation_id integer REFERENCES annotation(annotation_id),
    179     unique(notebook_id, annotation_id),
    180 );
    181 
    182 CREATE TABLE sources_versions (
    183     source_id integer REFERENCES target_source(source_id),
    184     version_id integer REFERENCES version(version_id),
    185     unique(source_id, version_id),
    186 );
    187 
    188 CREATE TABLE versions_cached_representations (
    189     version_id integer REFERENCES version(version_id),
    190     cached_representation_id integer REFERENCES cached_representation_info(cached_representation_id),
    191     unique(version_id, cached_representation_id),
    192 );
    193 
    194 -------------------------------------------------------------------------------
    195164--------------------------------------------------------------------------------------------
    196165--  <xs:simpleType name="Permission">
     
    203172
    204173
     174
     175CREATE TABLE permission_ (
     176  permission_mode text UNIQUE NOT NULL,
     177)
     178
     179-----------------------------------------------------------------------
     180--------------------- JOINT TABLES ------------------------------------
     181
     182CREATE TABLE annotations_target_sources (
     183   annotation_id integer REFERENCES annotation(annotation_id), -- defining a foreign key: there must be a uniquely defined row in "annotation", that is defined by "annotation_id"
     184   source_id integer REFERENCES target_source(source_id),
     185   unique(annotation_id, source_id),
     186);
     187
     188
     189
     190CREATE TABLE notebooks_annotations (
     191    notebook_id integer REFERENCES notebook(notebook_id),
     192    annotation_id integer REFERENCES annotation(annotation_id),
     193    unique(notebook_id, annotation_id),
     194);
     195
     196CREATE TABLE sources_versions (
     197    source_id integer REFERENCES target_source(source_id),
     198    version_id integer REFERENCES version(version_id),
     199    unique(source_id, version_id),
     200);
     201
     202CREATE TABLE versions_cached_representations (
     203    version_id integer REFERENCES version(version_id),
     204    cached_representation_id integer REFERENCES cached_representation_info(cached_representation_id),
     205    unique(version_id, cached_representation_id),
     206);
     207
     208-------------------------------------------------------------------------------
     209
     210
    205211--     <xs:complexType name="UserWithPermission">
    206212--         <xs:complexContent>
     
    225231annotation_id integer REFERENCES annotation(annotation_id),
    226232principal_id integer REFERENCES principal(principal_id),
    227 permission_  text,
     233permission_  text REFERENCES permission_(permission_mode),
    228234unique(annotation_id, principal_id),
    229 CHECK(permission_ = 'reader' OR permission_='writer' OR permission_='owner'),
    230235-- 1 soundness: ??? owner in this table must be the same as the owner in the annotation table ---
    231236-- 2 soundness ??? check for any pair (annotation, principal) there must be exactly one row in this table:
  • DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/resources/test-data/InsertTestData.sql

    r3216 r3217  
    142142---- PERMISSIONS --------------------------------------------------------------------------------------------
    143143
     144INSERT INTO permission_(permission_mode) VALUES ('owner');
     145INSERT INTO permission_(permission_mode) VALUES ('writer');
     146INSERT INTO permission_(permission_mode) VALUES ('reader');
     147
    144148INSERT INTO annotations_principals_permissions (annotation_id, principal_id, permission_) VALUES (2, 3, 'owner');
    145149INSERT INTO annotations_principals_permissions (annotation_id, principal_id, permission_) VALUES (2, 4, 'writer');
Note: See TracChangeset for help on using the changeset viewer.