NAME

App::Netdisco::Util::Permission

DESCRIPTION

Helper subroutines to support parts of the Netdisco application.

There are no default exports, however the :all tag will export all subroutines.

EXPORT_OK

acl_matches( $ip | $object | \%hash | \@item_list, $setting_name | $acl_entry | \@acl )

Given an IP address, object instance, or hash, returns true if the configuration setting $setting_name matches, else returns false.

Usage of this function is strongly advised to be of the form:

 QUIT/SKIP IF acl_matches

The function fails safe, so if the content of the setting or ACL is undefined or an empty string, then acl_matches also returns true.

If $setting_name is a valid setting, then it will be resolved to the access control list, else we assume you passed an ACL entry or ACL.

See the Netdisco wiki for details of what $acl may contain.

check_acl_no( $ip | $object | \%hash | \@item_list, $setting_name | $acl_entry | \@acl )

This is an alias for acl_matches.

acl_matches_only( $ip | $object | \%hash | \@item_list, $setting_name | $acl_entry | \@acl )

Given an IP address, object instance, or hash, returns true if the configuration setting $setting_name matches, else returns false.

Usage of this function is strongly advised to be of the form:

 QUIT/SKIP UNLESS acl_matches_only

The function fails safe, so if the content of the setting or ACL is undefined or an empty string, then acl_matches_only also returns false.

Further, if the setting or ACL resolves to a list but the list has no items, then acl_matches_only returns true (as if there is a successful match).

If $setting_name is a valid setting, then it will be resolved to the access control list, else we assume you passed an ACL entry or ACL.

See the Netdisco wiki for details of what $acl may contain.

check_acl_only( $ip | $object | \%hash | \@item_list, $setting_name | $acl_entry | \@acl )

This is an alias for acl_matches_only.

check_acl( $ip | $object | \%hash | \@item_list, $acl_entry | \@acl )

Given an IP address, object instance, or hash, compares it to the items in \@acl then returns true or false. You can control whether any item must match or all must match, and items can be negated to invert the match logic.

Also accepts an array reference of multiple IP addresses, object instances, and hashes, and will test against each in turn, for each ACL rule.

The slots alias, ip, switch, and addr are looked for in the instance or hash and used to compare a bare IP address (so it works with most Netdisco database classes, and the NetAddr::IP class). Any instance or hash slot can be used as an ACL named property.

There are several options for what \@acl may contain. See the Netdisco wiki for the details.