Charles L Bombard wrote:
> If I run the script that you gave me earlier, it will reset the midgard
> sitegroups to 1 for everything. This allowed me to login as the other users
> that were in the database. The result was that I was no longer able to login
> as the admin. Is there something else wrong that is preventing the admin
> from loginging and performing all its duties in the new sitegroup?
I can't asses that right now. I've attached a quicky perl script that
tells you the status each user has.
> The only way I found to allow the admin to login was to set the admingroup
> for the sitegroup to 0, set the sitegroup for the admin account to 0, and
> lastly setting the sitegroup for the host record for the admin area to be 0.
> This allowed the admin to login and perform admin duties (such as updating
> the code of the pages as well as creating users and groups, though I was not
> able to add users to groups). T
Because you were trying to add them to SG0. SG0 users can only be root.
> The others users were able to login as username;sg1 and were able to add
> articles to the site, but they are unable to add users or update groups.
I assume username+sg1 also works. The ';' means "if I'm an admin, drop
my admin rights". But in this case these users are not in SG0, or the
';' would not have worked.
> As for the asgard interface. I was able to install it.. but now I get an
> error when I try to go in:
>
> Parse error: parse error, expecting `T_VARIABLE' or `'$'' in
> snippet:///Asgard/Classes/Tree on line 1708
> ?><?
> // Tree managment class
> // can handle every Midgard object in an elegant fashion
I recommend installing mod_midgard-preparser for easier debugging.
Emile
#!/usr/bin/perl
use DBI;
use Getopt::Std;
getopts('td:u:p:U:P:');
$database = $opt_d ? $opt_d : "midgard";
$user = $opt_u ? $opt_u : "midgard";
$password = $opt_p ? $opt_p : "midgard";
$root = $opt_U ? $opt_U : 'root';
$rootpw = $opt_P ? $opt_P : '';
######
$driver=0;
foreach (DBI->available_drivers) {
($_ eq 'mysql') && ($driver = 1) && last;
}
if (!$driver) { fail("The MySQL DBD driver is not installed"); }
$dsn = "DBI:mysql:database=$database";
($dbh = DBI->connect($dsn, $user, $password)) || fail("Failed to connect as $user");
$sth = $dbh->prepare("
SELECT person.id,person.username,person.sitegroup,sitegroup.name
FROM person
LEFT JOIN sitegroup ON sitegroup.id=person.sitegroup
");
($sth && $sth->execute) || die "Cannot execute query: " . $dbh->errstr . "\n";
while (($id,$user,$sg,$sgname) = $sth->fetchrow_array()) {
$msg = ''; $delim = '+';
if ($sg == 0) { $sgname="SG0"; }
if ($user eq '') {
$msg = "[warning] No username";
} elsif ($sg == 0) {
$delim = '*';
$sth2 = $dbh->prepare("
SELECT id FROM member WHERE uid=$id AND gid=0 and sitegroup=0
");
($sth2 && $sth2->execute)
|| die "Cannot execute query: " . $dbh->errstr . "\n";
($member) = $sth2->fetchrow_array();
if (!$member) {
$msg = "[error] User in SG0 missing group 0 membership";
} else {
$msg = "[info] ROOT";
}
} else {
@grps = ();
$sth2 = $dbh->prepare("
SELECT gid FROM member WHERE uid=$id AND sitegroup<>$sg
");
($sth2 && $sth2->execute)
|| die "Cannot execute query: " . $dbh->errstr . "\n";
while (($grp) = $sth2->fetchrow_array()) { push @grps, $grp; }
if ($#grps >= 0) {
$msg = "[error] User has non-sg$sg membership records pointing to groups "
. join(', ', @grps);
} else {
@grps = ();
$sth2 = $dbh->prepare("
SELECT grp.sitegroup FROM grp,member
WHERE member.uid=$id AND member.gid = grp.id
AND grp.sitegroup<>$sg
");
($sth2 && $sth2->execute)
|| die "Cannot execute query: " . $dbh->errstr . "\n";
while (($grp) = $sth2->fetchrow_array()) { push @grps, $grp; }
if ($#grps >= 0) {
$msg = "[error] User is member of non-sg$sg groups "
. join(', ', @grps);
} else {
@grps = ();
$sth2 = $dbh->prepare("
SELECT sitegroup.id FROM sitegroup,member,grp
WHERE grp.id=sitegroup.admingroup
AND member.uid=$id AND member.gid = grp.id
");
($sth2 && $sth2->execute)
|| die "Cannot execute query: " . $dbh->errstr . "\n";
while (($grp) = $sth2->fetchrow_array()) { push @grps, $grp; }
if ($#grps >= 0) {
$msg = "[info] ADMIN";
}
}
}
}
print "$id/$sg: $user$delim$sgname";
if ($msg) { print ": $msg"; }
print "\n";
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]