head	1.2;
access;
symbols
	TIGRIS_1_1_0RC2:1.1.2.1
	TIGRIS_1_1:1.1.0.2;
locks; strict;
comment	@# @;


1.2
date	2001.08.07.20.34.40;	author edk;	state Exp;
branches;
next	1.1;

1.1
date	2001.08.07.20.33.54;	author edk;	state dead;
branches
	1.1.2.1;
next	;

1.1.2.1
date	2001.08.07.20.33.54;	author edk;	state Exp;
branches;
next	;


desc
@@


1.2
log
@add files used to fix up project documents wrt private / is_public:
* all current project documents should be made public (since private
  project documents weren't supported in 1.0.x), and this should be the
  default going forward
* some roles may have been given the Private Project Document - View
  permission as a workaround; if so, remove it so that they can be
  supported in the future.
@
text
@#!/usr/bin/perl

BEGIN {
    unshift @@INC, "$ENV{SANDBOX}/scripts";
}

use HelmDB;

my $DEBUG = 0;

my $dbh;

END
{
    $dbh->disconnect if $dbh;
}

main();

sub main
{
    $dbh = HelmDB::connect();
    # first, get the role ids for helm roles which shouldn't have this perm
    my @@role_ids = map $_->[0], (HelmDB::runQuery($dbh,
        "SELECT ROLE_ID ".
        "FROM HELM_ROLE ".
        "WHERE NAME in ('Anonymous Guest', 'Click-through Viewer', ".
            "'Content Viewer', 'Registered User')"
    ));

    print "got role_ids : @@role_ids\n" if $DEBUG;
 
    # second, get the action id for the private project document - view action
    my $action_id = (HelmDB::runQuery($dbh,
        "SELECT ACTION_ID ".
        "FROM HELM_ACTION ".
        "WHERE NAME = 'Private Project Document - View'"
    ))[0]->[0];

    print "got action id $action_id\n" if $DEBUG;

    if (! $action_id > 0)
    {
        die "unable to determine action_id (got $action_id) for ".
                "'Private Project Document - View'";
    }

    my $sql =
        "DELETE FROM HELM_ROLE_ACTION_RESOURCE ".
        "WHERE ACTION_ID = $action_id AND ROLE_ID IN (".
                join (',', @@role_ids). ")";

    print "going to run $sql\n" if $DEBUG;

    # third, delete the action for all the roles above
    HelmDB::runSQL($dbh, $sql);
}


@


1.1
log
@file ProjectDocument.pl was initially added on branch TIGRIS_1_1.
@
text
@d1 59
@


1.1.2.1
log
@add files used to fix up project documents wrt private / is_public:
* all current project documents should be made public (since private
  project documents weren't supported in 1.0.x), and this should be the
  default going forward
* some roles may have been given the Private Project Document - View
  permission as a workaround; if so, remove it so that they can be
  supported in the future.
@
text
@a0 59
#!/usr/bin/perl

BEGIN {
    unshift @@INC, "$ENV{SANDBOX}/scripts";
}

use HelmDB;

my $DEBUG = 0;

my $dbh;

END
{
    $dbh->disconnect if $dbh;
}

main();

sub main
{
    $dbh = HelmDB::connect();
    # first, get the role ids for helm roles which shouldn't have this perm
    my @@role_ids = map $_->[0], (HelmDB::runQuery($dbh,
        "SELECT ROLE_ID ".
        "FROM HELM_ROLE ".
        "WHERE NAME in ('Anonymous Guest', 'Click-through Viewer', ".
            "'Content Viewer', 'Registered User')"
    ));

    print "got role_ids : @@role_ids\n" if $DEBUG;
 
    # second, get the action id for the private project document - view action
    my $action_id = (HelmDB::runQuery($dbh,
        "SELECT ACTION_ID ".
        "FROM HELM_ACTION ".
        "WHERE NAME = 'Private Project Document - View'"
    ))[0]->[0];

    print "got action id $action_id\n" if $DEBUG;

    if (! $action_id > 0)
    {
        die "unable to determine action_id (got $action_id) for ".
                "'Private Project Document - View'";
    }

    my $sql =
        "DELETE FROM HELM_ROLE_ACTION_RESOURCE ".
        "WHERE ACTION_ID = $action_id AND ROLE_ID IN (".
                join (',', @@role_ids). ")";

    print "going to run $sql\n" if $DEBUG;

    # third, delete the action for all the roles above
    HelmDB::runSQL($dbh, $sql);
}


@

