* Added has_priv() to API::Std.

* Finished the host-based privilege/permission system.
* Fixed some typos.
This commit is contained in:
Elijah Perrault committed 2011-01-30 13:31:16 -07:00
1 parent fe30643e02
commit a22ee16ffb
3 files changed
+83 -1

No files matched your search

+19 -1
View File
@@ -331,7 +331,7 @@ sub trans
}
}
# Privilege subroutine.
# Match user subroutine.
sub match_user
{
my (%user) = @_;
@@ -359,6 +359,24 @@ sub match_user
return 0;
}
# Privilege subroutine.
sub has_priv
{
my ($cuser, $cpriv) = @_;
if (conf_get("user:$cuser:privs")) {
my $cups = (conf_get("user:$cuser:privs"))[0][0];
if (defined $Auto::PRIVILEGES{$cups}) {
foreach (@{ $Auto::PRIVILEGES{$cups} }) {
return 1 if ($_ eq $cpriv or $_ eq "ALL");
}
}
}
return 0;
}
# Error subroutine.
sub err
{