Changeset 67 for trunk/DNSDB.pm


Ignore:
Timestamp:
11/30/10 18:01:27 (13 years ago)
Author:
Kris Deugau
Message:

/trunk

checkpoint
Add user ACL handling nearing function
Add user/edit user pages merged; they're next to identical anyway
Group list images tweaked with proper "alpha channel", CSS fiddled again

  • final arrangement will probably be a couple of small triangles; pointing right for an expandable group, down for an expanded one

Option to add user to a different group removed

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/DNSDB.pm

    r66 r67  
    2525@ISA            = qw(Exporter);
    2626@EXPORT_OK      = qw(
    27         &initGlobals &initPermissions &getPermissions &changePermissions
     27        &initGlobals
     28        &initPermissions &getPermissions &changePermissions &comparePermissions
    2829        &connectDB &finish
    2930        &addDomain &delDomain &domainName
     
    3940@EXPORT         = (); # Export nothing by default.
    4041%EXPORT_TAGS    = ( ALL => [qw(
    41                 &initGlobals &initPermissions &getPermissions &changePermissions
     42                &initGlobals
     43                &initPermissions &getPermissions &changePermissions &comparePermissions
    4244                &connectDB &finish
    4345                &addDomain &delDomain &domainName
     
    294296
    295297
     298## DNSDB::comparePermissions()
     299# Compare two permission hashes
     300# Returns '>', '<', '=', '!'
     301sub comparePermissions {
     302  my $p1 = shift;
     303  my $p2 = shift;
     304
     305  my $retval = '=';     # assume equality until proven otherwise
     306
     307  no warnings "uninitialized";
     308
     309  foreach (@permtypes) {
     310    next if $p1->{$_} == $p2->{$_};     # equal is good
     311    if ($p1->{$_} && !$p2->{$_}) {
     312      if ($retval eq '<') {     # if we've already found an unequal pair where
     313        $retval = '!';          # $p2 has more access, and we now find a pair
     314        last;                   # where $p1 has more access, the overall access
     315      }                         # is neither greater or lesser, it's unequal.
     316      $retval = '>';
     317    }
     318    if (!$p1->{$_} && $p2->{$_}) {
     319      if ($retval eq '>') {     # if we've already found an unequal pair where
     320        $retval = '!';          # $p1 has more access, and we now find a pair
     321        last;                   # where $p2 has more access, the overall access
     322      }                         # is neither greater or lesser, it's unequal.
     323      $retval = '<';
     324    }
     325  }
     326  return $retval;
     327} # end comparePermissions()
     328
     329
    296330## DNSDB::_log()
    297331# Log an action
     
    640674  my $type = shift || 'u';      # create limited users by default - fwiw, not sure yet how this will interact with ACLs
    641675 
     676  my $permstring = shift || 'i';        # default is to inhert permissions from group
     677
    642678  my $fname = shift || $username;
    643679  my $lname = shift || '';
Note: See TracChangeset for help on using the changeset viewer.