Abilities
view release on metacpan or search on metacpan
lib/Abilities/Features.pm view on Meta::CPAN
package Abilities::Features;
# ABSTRACT: Extends Abilities with plan management for subscription-based web services.
use Carp;
use Hash::Merge qw/merge/;
use Moo::Role;
use namespace::autoclean;
our $VERSION = "0.5";
$VERSION = eval $VERSION;
=head1 NAME
Abilities::Features - Extends Abilities with plan management for subscription-based web services.
=head1 VERSION
version 0.5
=head1 SYNOPSIS
package Customer;
use Moose; # or Moo
with 'Abilities::Features';
# ... define required methods ...
# somewhere else in your code:
# get a customer object that consumed the Abilities::Features role
my $customer = MyApp->get_customer('some_company');
# check if the customer has a certain feature
if ($customer->has_feature('ssl_encryption')) {
&initiate_https_connection();
} else {
&initiate_http_connection();
}
=head1 DESCRIPTION
This L<Moo role|Moo::Role> extends the ability-based authorization
system defined by the L<Abilities> module with customer and plan management
for subscription-based web services. This includes paid services, where
customers subscribe to a plan from a list of available plans, each plan
with a different set of features. Examples of such a service are GitHub
(a Git revision control hosting service, where customers purchase a plan
that provides them with different amounts of storage, SSH support, etc.)
and MailChimp (email marketing service where customers purchase plans
that provide them with different amounts of monthly emails to send and
other features).
The L<Abilities> role defined three entities: users, roles and actions.
This role defines three more entities: customers, plans and features.
Customers are organizations, companies or individuals that subscribe to
your web service. They can subscribe to any number of plans, and thus be
provided with the features of these plans. The users from the Abilities
module will now be children of the customers. They still go on being members
of roles and performing actions they are granted with, but now possibly
only within the scope of their parent customer, and to the limits defined
in the customer's plan. Plans can inherit features from other plans, allowing
for defining plans faster and easier.
Customer and plan objects are meant to consume the Abilities::Features
role. L<Entities> is a reference implementation of both the L<Abilities> and
L<Abilities::Features> roles. It is meant to be used as-is by web applications,
( run in 0.533 second using v1.01-cache-2.11-cpan-75ffa21a3d4 )