head	1.3;
access;
symbols
	TIGRIS_1_1_0RC2:1.1.2.1.4.1
	TIGRIS_1_1_0RC1:1.1.2.1.4.1
	TIGRIS_1_1:1.1.2.1.4.1.0.2
	TIGRIS_1_0_8:1.1.2.1
	TIGRIS_1_0_8RC3:1.1.2.1
	TIGRIS_1_0_8RC2:1.1.2.1
	TIGRIS_1_0_8RC1:1.1.2.1
	TIGRIS_1_0_7:1.1.2.1
	TIGRIS_1_0_7RC3:1.1.2.1
	TIGRIS_1_0_7RC2:1.1.2.1
	TIGRIS_1_0_7RC1:1.1.2.1
	TIGRIS_1_0_6:1.1.2.1
	TIGRIS_1_0_6RC5:1.1.2.1
	TIGRIS_1_0_6RC4:1.1.2.1
	TIGRIS_1_0_6RC3:1.1.2.1
	TIGRIS_1_0_6RC2:1.1.2.1
	TIGRIS_1_0_6RC1:1.1.2.1
	TIGRIS_1_0_5:1.1.2.1
	TIGRIS_1_0_5RC6:1.1.2.1
	TIGRIS_1_0_5RC5:1.1.2.1
	TIGRIS_1_0_5RC4:1.1.2.1
	TIGRIS_1_0_5RC3:1.1.2.1
	TIGRIS_1_0_5RC2:1.1.2.1
	TIGRIS_1_0_5RC1:1.1.2.1
	TIGRIS_1_0_4:1.1.2.1
	TIGRIS_1_0_3:1.1.2.1
	TIGRIS_1_0_2:1.1.2.1
	TIGRIS_1_0_1:1.1.2.1
	TIGRIS_1_0:1.1.2.1.0.4
	TIGRIS_1_0_0:1.1.2.1
	TIGRIS_1_0_0_RC1:1.1.0.2;
locks; strict;
comment	@# @;


1.3
date	2001.06.05.10.50.57;	author edk;	state Exp;
branches;
next	1.2;

1.2
date	2001.04.06.01.18.19;	author leonardr;	state Exp;
branches;
next	1.1;

1.1
date	2001.03.17.07.50.48;	author leonardr;	state Exp;
branches
	1.1.2.1;
next	;

1.1.2.1
date	2001.04.06.01.27.33;	author dlr;	state Exp;
branches
	1.1.2.1.4.1;
next	;

1.1.2.1.4.1
date	2001.07.24.18.05.57;	author edk;	state Exp;
branches;
next	;


desc
@@


1.3
log
@add an index to the temp table : we join against it several times--without
this index, it take prohibitively long with a relatively small data set.
@
text
@
####################################################
##
## Create a temp table to hold the non-keyed values
##
##

drop table if exists xxxx_populate_UserRoleProject;
create table xxxx_populate_UserRoleProject
(
        USER_LOGIN    varchar(32) NOT NULL,
        ROLE_NAME     varchar(99) NOT NULL,
        PROJECT_NAME  varchar(64) NOT NULL,
        APPROVED_BY   varchar(32),
        INDEX (USER_LOGIN)
);

insert into xxxx_populate_UserRoleProject (USER_LOGIN, ROLE_NAME, PROJECT_NAME, APPROVED_BY)
       values 

#All registered users get the "Registered User" role. They also get the
#"Content Viewer" role in the www project.
	      ("*Domain Users", "Registered User", "*All public projects in domain", "root")
	    , ("*Domain Users", "Content Viewer", "www", "root")
	    , ("**Host Users", "Registered User", "**All projects on host", "root")
	    , ("**Host Users", "Content Viewer", "www", "root")
            , ("guest", "Anonymous Guest",          "*All public projects in domain", "root")
            , ("guest", "Click-through Viewer",          "*All projects in domain", "root")
            , ("guest", "Content Viewer",       "www", "root")

#Root is Host admin.
            , ("root", "Host Admin",          "**All projects on host", "root")
            , ("root", "Project Owner",       "www", "root")
            , ("root", "Click-through Viewer","**All projects on host", "root")
            , ("root", "Project Owner",       "look", "root")

            , ("webmaster", "Project Owner",  "www", "root")
            , ("webmaster", "Project Owner",  "look", "root")
;

insert into xxxx_populate_UserRoleProject (USER_LOGIN, ROLE_NAME, PROJECT_NAME, APPROVED_BY)
       select HELM_USER.LOGIN_NAME, "Host Admin", "**All projects on host", "root" from 
          Role, UserRole, HELM_USER
        where (HELM_USER.USER_ID=UserRole.userID and Role.roleID = UserRole.roleID and Role.name="Web Admin");


insert into xxxx_populate_UserRoleProject (USER_LOGIN, ROLE_NAME, PROJECT_NAME, APPROVED_BY)
       select HELM_USER.LOGIN_NAME, "Domain Admin", "*All projects on domain", "root" from 
          Role, UserRole, HELM_USER
        where (HELM_USER.USER_ID=UserRole.userID and Role.roleID = UserRole.roleID and Role.name="Sponsor Admin");

insert into xxxx_populate_UserRoleProject (USER_LOGIN, ROLE_NAME, PROJECT_NAME, APPROVED_BY)
       select username, "Project Owner", project, "root" from project_privs where (config_priv="Y" or grant_priv="Y");

insert into xxxx_populate_UserRoleProject (USER_LOGIN, ROLE_NAME, PROJECT_NAME, APPROVED_BY)
       select username, "Developer", project, "root" from project_privs where (config_priv="N" and grant_priv="N" and commit_priv="Y");

insert into xxxx_populate_UserRoleProject (USER_LOGIN, ROLE_NAME, PROJECT_NAME, APPROVED_BY)
       select username, "Observer", project, "root" from project_privs where (config_priv="N" and grant_priv="N" and commit_priv="N" and checkout_priv="Y");

#Role, UserRole, and project_privs have served their purpose.
drop table project_privs;
drop table Role;
drop table UserRole;

##
## now insert the values into the correct table replacing
## names with ids from the corresponding tables
##

# when APPROVED_BY = NULL
insert into HELM_USER_ROLE_PROJECT (USER_ID, ROLE_ID, PROJECT_ID, APPROVED_BY)
       select distinct User.USER_ID, Role.ROLE_ID, Project.PROJECT_ID, NULL
         from xxxx_populate_UserRoleProject as Tmp,
              HELM_USER as User,
              HELM_ROLE as Role,
              HELM_PROJECT as Project,
              HELM_USER as Approved
        where Tmp.USER_LOGIN   = User.LOGIN_NAME
          and Tmp.ROLE_NAME    = Role.NAME
          and Tmp.PROJECT_NAME = Project.NAME
          and ISNULL( Tmp.APPROVED_BY )
;

insert into HELM_USER_ROLE_PROJECT (USER_ID, ROLE_ID, PROJECT_ID, APPROVED_BY)
       select distinct User.USER_ID, Role.ROLE_ID, Project.PROJECT_ID, Approved.USER_ID
         from xxxx_populate_UserRoleProject as Tmp,
              HELM_USER as User,
              HELM_ROLE as Role,
              HELM_PROJECT as Project,
              HELM_USER as Approved
        where Tmp.USER_LOGIN   = User.LOGIN_NAME
          and Tmp.ROLE_NAME    = Role.NAME
          and Tmp.PROJECT_NAME = Project.NAME
          and Tmp.APPROVED_BY  = Approved.LOGIN_NAME
;

drop table if exists xxxx_populate_UserRoleProject;






@


1.2
log
@Guest needs to have Content Viewer role on the www project.
@
text
@d14 2
a15 1
        APPROVED_BY   varchar(32)
@


1.1
log
@Added scripts to convert from Tigris Classic (tm) to Tigris 1.0.0 (tm). Lovely. A few TODOs: 1) Convert project_mlists into Anzu options. 2) Figure out what to do with the domain_config table. 3) Put in the Eyebrowse tables. 4) Plug in the Bugzilla -> Issuezilla conversion script (yet to be written). That's all for today, I'm going home.
@
text
@d28 1
@


1.1.2.1
log
@Merged in leonardr bug fix from HEAD:

Guest needs to have Content Viewer role on the www project.
@
text
@a27 1
            , ("guest", "Content Viewer",       "www", "root")
@


1.1.2.1.4.1
log
@port back a change for reasonable performance when migrating moderate
amounts of data
@
text
@d14 1
a14 2
        APPROVED_BY   varchar(32),
        INDEX(USER_LOGIN, ROLE_NAME, PROJECT_NAME, APPROVED_BY)
@


