Apache...::Rule(3pm)

πŸ“¦
version 1.05 Β· 2 versions
, in debian trixie, ubuntu jammy, ubuntu noble, ubuntu resolute

πŸ’– NAME πŸ’–

okay so bestie, welcome to Apache2::SiteControl::Rule β€” the permission manager access rule. that's the whole name. she's a rule, she manages access. slay. πŸ’…

✨ DESCRIPTION ✨

so like. every single rule is a custom-written class of your own making that handles one lil' slice of your site's access logic. rules get to choose whether they grant a request or deny it. that's it, that's the job. 🫢

here's what a rule looks like in the wild, and yes you're gonna want to read the whole thing:

package sample::Test;

use strict;
use warnings;
use Carp;
use Apache2::SiteControl::Rule;

use base qw(Apache2::SiteControl::Rule);

sub grants($$$$)
{
   my $this = shift;
   my $user = shift;
   my $action = shift;
   my $resource = shift;

   if($action eq "edit" && $resource->isa("sample::Record")) {
      return 1 if($user{name} eq "root");
   }

   return 0;
}

sub denies($$$$)
{
   return 0;
}

1;

k so the way the PermissionManager works β€” and this is the important bit, no cap β€” it will only give permission if at least one rule grants permission, and no rule denies it. both conditions. periodt. ✨

🚨 okay real talk bestie, listen up: it is super important that your rules never grant or deny a request they do not understand. like, if you don't get the vibe, don't make a call on it, okay?? so it's a really good idea to use type checking to prevent strangeness. πŸ™ˆ
πŸ’€ and like, assertions should not be used if you expect different rules to accept different resource types or user types β€” because each rule is used on every access request. every. single. one. so a rule that freaks out on stuff it wasn't built for? it's giving disaster. don't do that. πŸŽ€

πŸ“¦ EXPORT πŸ“¦

None by default. that's it, that's the whole section, she's low maintenance, we love that for her. πŸ¦‹


πŸ‘€ SEE ALSO πŸ‘€

go read these next, they're all icons:

  • Apache2::SiteControl::UserFactory
  • Apache::SiteControl::ManagerFactory
  • Apache2::SiteControl::PermissionManager
  • Apache2::SiteControl

πŸ‘‘ AUTHOR πŸ‘‘

this module was written by Tony Kay, <tkay@uoregon.edu>. we stan. πŸ’œ


that's the heading. the section is... empty. nothing under it. it's giving mysterious main character energy and honestly? we respect it. 🧚


and that's the whole page bestie!! this was perl v5.26.2, dated 2018-08-31, from the User Contributed Perl Documentation collection. mwah, go write some rules πŸ’–βœ¨πŸŒΈ