Changeset 203 for trunk


Ignore:
Timestamp:
12/16/11 16:00:26 (13 years ago)
Author:
Kris Deugau
Message:

/trunk

Set all individual permission flags on any failure to retrieve group
permissions. Case discovered was group 1 missing its group_permissions
entry, causing a Perl error since a SELECT with no rows does not result
in a DBI error in fetchrow_hashref()

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/vega-import.pl

    r200 r203  
    182182
    183183  $grppget->execute($grpid) or warn $grppget->errstr;
    184   my $oldp = $grppget->fetchrow_hashref() or warn $grppget->errstr;
     184  my $oldp;
     185  unless ($oldp = $grppget->fetchrow_hashref()) {
     186    foreach my $permtype ('self_edit', 'group_create', 'group_edit', 'group_delete', 'user_create',
     187        'user_edit', 'user_delete', 'domain_create', 'domain_edit', 'domain_delete', 'record_create',
     188        'record_edit', 'record_delete') { $oldp->{$permtype} = 't'; }
     189  }
    185190
    186191  # de-nullify
     
    287292
    288293  $grppget->execute($oldgrpid) or warn $grppget->errstr;
    289   my $oldp = $grppget->fetchrow_hashref() or warn $grppget->errstr;
     294  my $oldp;
     295  unless ($oldp = $grppget->fetchrow_hashref()) {
     296    foreach my $permtype ('self_edit', 'group_create', 'group_edit', 'group_delete', 'user_create',
     297        'user_edit', 'user_delete', 'domain_create', 'domain_edit', 'domain_delete', 'record_create',
     298        'record_edit', 'record_delete') { $oldp->{$permtype} = 't'; }
     299  }
    290300
    291301  # de-nullify
Note: See TracChangeset for help on using the changeset viewer.