head	1.3;
access;
symbols;
locks; strict;
comment	@# @;


1.3
date	2001.08.27.21.48.13;	author leonardr;	state Exp;
branches;
next	1.2;

1.2
date	2001.08.27.21.20.13;	author dlr;	state Exp;
branches;
next	1.1;

1.1
date	2001.07.30.18.44.24;	author leonardr;	state Exp;
branches;
next	;


desc
@@


1.3
log
@Corrected SQL for real.
@
text
@insert into HELM_ROLE_ACTION_RESOURCE (ROLE_ID, ACTION_ID, RESOURCE_ID)
    select HELM_ROLE.ROLE_ID, HELM_ACTION.ACTION_ID,
           HELM_RESOURCE.RESOURCE_ID
      from HELM_ROLE, HELM_ACTION, HELM_RESOURCE
     where HELM_ROLE.NAME = "Registered User"
       and HELM_RESOURCE.DESCRIPTION in ("All applicable resources")
       and HELM_ACTION.NAME in ( "Project Issue Tracking - Submit" )
;

########################################################################

#Roles which get new actions depending on whether they have other
#actions.

drop table if exists xxxx_ROLES_WITH_ACTION;
create table xxxx_ROLES_WITH_ACTION  
(
    ROLE_ID		INTEGER NOT NULL,
    RESOURCE_ID         INTEGER NOT NULL
);

#"ProjectGroup - Edit" -> "Project - Edit"
insert into xxxx_ROLES_WITH_ACTION 
 select ROLE_ID, RESOURCE_ID from HELM_ROLE_ACTION_RESOURCE, HELM_ACTION 
 where HELM_ACTION.ACTION_ID=HELM_ROLE_ACTION_RESOURCE.ACTION_ID 
  and HELM_ACTION.NAME="ProjectGroup - Edit";

insert into HELM_ROLE_ACTION_RESOURCE
 select xxxx_ROLES_WITH_ACTION.ROLE_ID, HELM_ACTION.ACTION_ID, 
	xxxx_ROLES_WITH_ACTION.RESOURCE_ID
 from xxxx_ROLES_WITH_ACTION, HELM_ACTION
 where HELM_ACTION.NAME="Project - Edit";

delete from xxxx_ROLES_WITH_ACTION;

#"VersionControl - Checkout" augmented by "VersionControl - Blame"
insert into xxxx_ROLES_WITH_ACTION 
 select ROLE_ID, RESOURCE_ID from HELM_ROLE_ACTION_RESOURCE, HELM_ACTION 
 where HELM_ACTION.ACTION_ID=HELM_ROLE_ACTION_RESOURCE.ACTION_ID 
  and HELM_ACTION.NAME="VersionControl - Checkout";

insert into HELM_ROLE_ACTION_RESOURCE
 select xxxx_ROLES_WITH_ACTION.ROLE_ID, HELM_ACTION.ACTION_ID, 
	xxxx_ROLES_WITH_ACTION.RESOURCE_ID
 from xxxx_ROLES_WITH_ACTION, HELM_ACTION
 where HELM_ACTION.NAME="VersionControl - Blame";

delete from xxxx_ROLES_WITH_ACTION;

#"ProjectGroup - Delete" -> "Project - Delete"
insert into xxxx_ROLES_WITH_ACTION 
 select ROLE_ID, RESOURCE_ID from HELM_ROLE_ACTION_RESOURCE, HELM_ACTION 
 where HELM_ACTION.ACTION_ID=HELM_ROLE_ACTION_RESOURCE.ACTION_ID 
  and HELM_ACTION.NAME="ProjectGroup - Delete";

insert into HELM_ROLE_ACTION_RESOURCE
 select xxxx_ROLES_WITH_ACTION.ROLE_ID, HELM_ACTION.ACTION_ID, 
	xxxx_ROLES_WITH_ACTION.RESOURCE_ID
 from xxxx_ROLES_WITH_ACTION, HELM_ACTION
 where HELM_ACTION.NAME="Project - Delete";

delete from xxxx_ROLES_WITH_ACTION;

#"ProjectGroup - View" -> "Project - View"
insert into xxxx_ROLES_WITH_ACTION 
 select ROLE_ID, RESOURCE_ID from HELM_ROLE_ACTION_RESOURCE, HELM_ACTION 
 where HELM_ACTION.ACTION_ID=HELM_ROLE_ACTION_RESOURCE.ACTION_ID 
  and HELM_ACTION.NAME="ProjectGroup - View";

insert into HELM_ROLE_ACTION_RESOURCE
 select xxxx_ROLES_WITH_ACTION.ROLE_ID, HELM_ACTION.ACTION_ID, 
	xxxx_ROLES_WITH_ACTION.RESOURCE_ID
 from xxxx_ROLES_WITH_ACTION, HELM_ACTION
 where HELM_ACTION.NAME="Project - View";

delete from xxxx_ROLES_WITH_ACTION;

#"ProjectGroup - Element {Add, Delete}" -> "Project - Associate Project"
insert into xxxx_ROLES_WITH_ACTION 
 select ROLE_ID, RESOURCE_ID from HELM_ROLE_ACTION_RESOURCE, HELM_ACTION 
 where HELM_ACTION.ACTION_ID=HELM_ROLE_ACTION_RESOURCE.ACTION_ID 
  and HELM_ACTION.NAME in ("ProjectGroup - Element Add", 
	              "ProjectGroup - Element Delete");

insert into HELM_ROLE_ACTION_RESOURCE
 select xxxx_ROLES_WITH_ACTION.ROLE_ID, HELM_ACTION.ACTION_ID, 
	xxxx_ROLES_WITH_ACTION.RESOURCE_ID
 from xxxx_ROLES_WITH_ACTION, HELM_ACTION
 where HELM_ACTION.NAME="Project - Associate Project";

delete from xxxx_ROLES_WITH_ACTION;

#"ProjectGroup - Add" augmented by "Category - Add"
insert into xxxx_ROLES_WITH_ACTION 
 select ROLE_ID, RESOURCE_ID from HELM_ROLE_ACTION_RESOURCE, HELM_ACTION 
 where HELM_ACTION.ACTION_ID=HELM_ROLE_ACTION_RESOURCE.ACTION_ID 
  and HELM_ACTION.NAME in ("ProjectGroup - Add");

insert into HELM_ROLE_ACTION_RESOURCE
 select xxxx_ROLES_WITH_ACTION.ROLE_ID, HELM_ACTION.ACTION_ID, 
	xxxx_ROLES_WITH_ACTION.RESOURCE_ID
 from xxxx_ROLES_WITH_ACTION, HELM_ACTION
 where HELM_ACTION.NAME="Category - Add";

delete from xxxx_ROLES_WITH_ACTION;

drop table xxxx_ROLES_WITH_ACTION;

########################################################################
#Owner roles get specific new actions.

drop table if exists xxxx_OWNER_ROLES;
create table xxxx_OWNER_ROLES 
(
    ROLE_ID		INTEGER NOT NULL,
    TYPE                VARCHAR(7) NOT NULL
);

insert into xxxx_OWNER_ROLES select HELM_ROLE.ROLE_ID, HELM_ROLE.TYPE
 from HELM_ROLE, HELM_ATTRIBUTE, HELM_ATTRIBUTE_VALUE
 where HELM_ROLE.ROLE_ID = HELM_ATTRIBUTE_VALUE.ENTITY_ID 
 and HELM_ATTRIBUTE.ENTITY_TYPE="Role" 
 and HELM_ATTRIBUTE.NAME="denotesOwnership" 
 and HELM_ATTRIBUTE_VALUE.ATTRIBUTE_ID = HELM_ATTRIBUTE.ATTRIBUTE_ID
 and HELM_ATTRIBUTE_VALUE.VALUE="Y"
;

insert into HELM_ROLE_ACTION_RESOURCE select ROLE_ID, ACTION_ID, 1 
 from xxxx_OWNER_ROLES, HELM_ACTION
 where xxxx_OWNER_ROLES.TYPE in ("Project")
 and HELM_ACTION.NAME in ("Project Role - Add"
                        , "Project Role - Edit"
                        , "Project Role - Delete"
                        , "Resource - Add"
                        , "Resource - Edit")                      

insert into HELM_ROLE_ACTION_RESOURCE select ROLE_ID, ACTION_ID, 1 
 from xxxx_OWNER_ROLES, HELM_ACTION
 where xxxx_OWNER_ROLES.TYPE in ("Host", "Domain", "Project")
 and HELM_ACTION.NAME in ("Project - Associate With Project"
                        , "Project - Designate Subproject"
                        , "Project - Designate Superproject");

insert into HELM_ROLE_ACTION_RESOURCE select ROLE_ID, ACTION_ID, 1 
 from xxxx_OWNER_ROLES, HELM_ACTION
 where xxxx_OWNER_ROLES.TYPE in ("Host", "Domain")
 and HELM_ACTION.NAME in ("Category - Add"
                        , "Licenses - Administer"
                        , "Project - Associate Project");

drop table xxxx_OWNER_ROLES;@


1.2
log
@Moved mis-placed SQL statements.
@
text
@d32 3
a34 2
 where HELM_ACTION.NAME="Project - Edit"
;
d37 5
d46 3
a48 2
 where HELM_ACTION.NAME="VersionControl - Checkout"
;
a55 5
insert into xxxx_ROLES_WITH_ACTION 
 select ROLE_ID, RESOURCE_ID from HELM_ROLE_ACTION_RESOURCE, HELM_ACTION 
 where HELM_ACTION.ACTION_ID=HELM_ROLE_ACTION_RESOURCE.ACTION_ID 
  and HELM_ACTION.NAME="ProjectGroup - Delete";

d60 1
a60 2
 where HELM_ACTION.NAME="Project - Delete"
;
d62 1
d74 3
a76 2
 where HELM_ACTION.NAME="Project - View"
;
d89 3
a91 2
 where HELM_ACTION.NAME="Project - Associate Project"
;
d97 1
a97 2
  and HELM_ACTION.NAME in ("ProjectGroup - Add")
;
d103 3
a105 2
 where HELM_ACTION.NAME="Category - Add"
;
@


1.1
log
@Moved stuff from 1.1.0 migration directory to 1.2.0 directory to reflect actual future versioning.
@
text
@a35 5
insert into xxxx_ROLES_WITH_ACTION 
 select ROLE_ID, RESOURCE_ID from HELM_ROLE_ACTION_RESOURCE, HELM_ACTION 
 where HELM_ACTION.ACTION_ID=HELM_ROLE_ACTION_RESOURCE.ACTION_ID 
  and HELM_ACTION.NAME="ProjectGroup - Delete";

d44 5
@

