diff --git a/lib/WebGUI/Group.pm b/lib/WebGUI/Group.pm index f2ed9326e..ae55f4360 100644 --- a/lib/WebGUI/Group.pm +++ b/lib/WebGUI/Group.pm @@ -1561,4 +1561,24 @@ sub userGroupExpireDate { } } +#------------------------------------------------------------------- + +=head2 vitalGroup ( $groupId ) + +Class method to check to see if a group is a reserved WebGUI group. Returns +true or false. Placed in here because I found two different lists in two +different areas. + +=head3 $groupId + +A GUID of the group to check. + +=cut + +sub vitalGroup { + my $class = shift; + my $groupId = shift; + return isIn ( $groupId, (1..17), qw/pbgroup000000000000015 pbgroup000000000000016 pbgroup000000000000017 / ); +} + 1; diff --git a/t/Group.t b/t/Group.t index c421f6fde..61dd929e3 100644 --- a/t/Group.t +++ b/t/Group.t @@ -75,7 +75,7 @@ my @ipTests = ( ); -plan tests => (148 + scalar(@scratchTests) + scalar(@ipTests)); # increment this value for each test you create +plan tests => (152 + scalar(@scratchTests) + scalar(@ipTests)); # increment this value for each test you create my $session = WebGUI::Test->session; my $testCache = WebGUI::Cache->new($session, 'myTestKey'); @@ -675,6 +675,17 @@ SKIP: { # ################################################################ +################################################################ +# +# vitalGroup +# +################################################################ + +ok( WebGUI::Group->vitalGroup(7), 'vitalGroup: 7'); +ok( WebGUI::Group->vitalGroup(3), '... 3'); +ok( WebGUI::Group->vitalGroup('pbgroup000000000000015'), '... pbgroup000000000000015'); +ok(! WebGUI::Group->vitalGroup('27'), '... 27 is not vital'); + END { $session->db->dbh->do('DROP TABLE IF EXISTS myUserTable'); $testCache->flush;