-- USE `ncia`;

insert into csm_application(APPLICATION_NAME,APPLICATION_DESCRIPTION,DECLARATIVE_FLAG,ACTIVE_FLAG,UPDATE_DATE)
values ("csmupt","CSM UPT Super Admin Application",0,0,sysdate());
 
insert into csm_protection_element(PROTECTION_ELEMENT_NAME,PROTECTION_ELEMENT_DESCRIPTION,OBJECT_ID,APPLICATION_ID,UPDATE_DATE)
values("csmupt","CSM UPT Super Admin Application Protection Element","csmupt",1,sysdate());

insert into csm_user_pe(PROTECTION_ELEMENT_ID,USER_ID,UPDATE_DATE)
values(1,1,sysdate());

INSERT INTO csm_application(APPLICATION_NAME,APPLICATION_DESCRIPTION,DECLARATIVE_FLAG,ACTIVE_FLAG,UPDATE_DATE)
VALUES ("NCIA","Application Description",0,0,sysdate());

insert into csm_protection_element(PROTECTION_ELEMENT_NAME,PROTECTION_ELEMENT_DESCRIPTION,OBJECT_ID,APPLICATION_ID,UPDATE_DATE)
values("NCIA","NCIA Admin Application Protection Element","NCIA",1,sysdate());

INSERT INTO CSM_ROLE ( ROLE_ID, ROLE_NAME, ROLE_DESCRIPTION, APPLICATION_ID, ACTIVE_FLAG, UPDATE_DATE ) 
VALUES (2, 'NCIA.ADMIN', 'UPT access role', 2, 0, sysdate());

INSERT INTO CSM_ROLE ( ROLE_ID, ROLE_NAME, ROLE_DESCRIPTION, APPLICATION_ID, ACTIVE_FLAG, UPDATE_DATE ) 
VALUES (3, 'NCIA.CURATE', 'Add or modify curation data', 2, 0, sysdate());

INSERT INTO CSM_ROLE ( ROLE_ID, ROLE_NAME, ROLE_DESCRIPTION, APPLICATION_ID, ACTIVE_FLAG, UPDATE_DATE ) 
VALUES ( 4, 'NCIA.MANAGE_VISIBILITY_STATUS', 'Manage Visibility Status', 2, 0, sysdate());

INSERT INTO CSM_ROLE ( ROLE_ID, ROLE_NAME, ROLE_DESCRIPTION, APPLICATION_ID, ACTIVE_FLAG, UPDATE_DATE ) 
VALUES (5, 'NCIA.VIEW_SUBMISSION_REPORT', 'View submission report', 2, 0, sysdate());

INSERT INTO CSM_ROLE ( ROLE_ID, ROLE_NAME, ROLE_DESCRIPTION, APPLICATION_ID, ACTIVE_FLAG, UPDATE_DATE ) 
VALUES (1, 'NCIA.READ', 'public role', 2, 0, sysdate());

INSERT INTO CSM_PROTECTION_GROUP( PROTECTION_GROUP_ID, PROTECTION_GROUP_NAME, PROTECTION_GROUP_DESCRIPTION, APPLICATION_ID, LARGE_ELEMENT_COUNT_FLAG, UPDATE_DATE) 
VALUES ( 1, 'NCIA.PUBLIC', 'Public', 2, 0, sysdate());

#
# The following entries are Common Set of Privileges
#

INSERT INTO csm_privilege (privilege_name, privilege_description, update_date)
VALUES("CREATE","This privilege grants permission to a user to create an entity. This entity can be an object, a database entry, or a resource such as a network connection", sysdate());

INSERT INTO csm_privilege (privilege_name, privilege_description, update_date)
VALUES("ACCESS","This privilege allows a user to access a particular resource.  Examples of resources include a network or database connection, socket, module of the application, or even the application itself", sysdate());

INSERT INTO csm_privilege (privilege_name, privilege_description, update_date)
VALUES("READ","This privilege permits the user to read data from a file, URL, database, an object, etc. This can be used at an entity level signifying that the user is allowed to read data about a particular entry", sysdate());

INSERT INTO csm_privilege (privilege_name, privilege_description, update_date)
VALUES("WRITE","This privilege allows a user to write data to a file, URL, database, an object, etc. This can be used at an entity level signifying that the user is allowed to write data about a particular entity", sysdate());

INSERT INTO csm_privilege (privilege_name, privilege_description, update_date)
VALUES("UPDATE","This privilege grants permission at an entity level and signifies that the user is allowed to update data for a particular entity. Entities may include an object, object attribute, database row etc", sysdate());

INSERT INTO csm_privilege (privilege_name, privilege_description, update_date)
VALUES("DELETE","This privilege permits a user to delete a logical entity. This entity can be an object, a database entry, a resource such as a network connection, etc", sysdate());

INSERT INTO csm_privilege (privilege_name, privilege_description, update_date)
VALUES("EXECUTE","This privilege allows a user to execute a particular resource. The resource can be a method, function, behavior of the application, URL, button etc", sysdate());

insert into csm_user_pe(PROTECTION_ELEMENT_ID,USER_ID,UPDATE_DATE)
values(2,1,sysdate());

insert into hibernate_unique_key (next_hi) values (1);

COMMIT;