Changeset 674 for LATMOS-Accounts/lib


Ignore:
Timestamp:
01/20/10 02:13:17 (14 years ago)
Author:
nanardon
Message:
  • add two functions in Utils module:
    • check_oid_validity(): check object name validity
    • check_ug_validity(): check user and group name validity
File:
1 edited

Legend:

Unmodified
Added
Removed
  • LATMOS-Accounts/lib/LATMOS/Accounts/Utils.pm

    r660 r674  
    112112} 
    113113 
     114sub check_oid_validity { 
     115    my ($name) = @_; 
     116    return "leadind space" if ($name =~ /^\s/); 
     117    return "trailing space" if ($name =~ /\s$/); 
     118    return "containing space" if ($name =~ /\s/); 
     119 
     120    return; 
     121} 
     122 
     123sub check_ug_validity { 
     124    my ($name) = @_; 
     125    return "first caractere must be a-z" 
     126        if ($name !~ /^[a-z]/); 
     127    return "must contain only a-z,0-9" 
     128        if ($name !~ /^[a-z,0-9]+$/); 
     129 
     130    return check_oid_validity($name); 
     131} 
     132 
    1141331; 
Note: See TracChangeset for help on using the changeset viewer.