Apache-AuthzPasswd

 view release on metacpan or  search on metacpan

AuthzPasswd.pm  view on Meta::CPAN


	#ok if user is one of these users
	if ($require eq "user") {
	    return MP2 ? Apache::OK : Apache::Constants::OK if grep $name eq $_, @list;
	}
	#ok if user is simply authenticated
	elsif ($require eq "valid-user") {
	    return MP2 ? Apache::OK : Apache::Constants::OK;
	}
	elsif ($require eq "group") {
	    # Get users primary group's gid
	    my $ugid= [ getpwnam($name) ]->[3];
	    foreach my $thisgroup (@list) {
		# Then check if the user is member of the group
		my ($group, $passwd, $gid, $members) = getgrnam $thisgroup;
		unless($group) {
		    $r->note_basic_auth_failure;
		    MP2 ? $r->log_error("Apache::AuthzPasswd - group: $thisgroup unknown", $r->uri) : $r->log_reason("Apache::AuthzPasswd - group: $thisgroup unknown", $r->uri);
		    return MP2 ? Apache::HTTP_INTERNAL_SERVER_ERROR : Apache::Constants::HTTP_INTERNAL_SERVER_ERROR;
		}
		if($ugid == $gid || $members =~ /\b$name\b/) {
		    if($setremotegroup eq "yes") {
			$r->log->debug("Setting REMOTE_GROUP to $group");
			my $x = $r->subprocess_env(REMOTE_GROUP => $group);
		    }
		    return MP2 ? Apache::OK : Apache::Constants::OK;
		}
	    }
	}
    }
    



( run in 0.503 second using v1.01-cache-2.11-cpan-ceb78f64989 )