עידו פרלמוטר (Ido Perlmuter) > Entities-0.2 > Entities::Backend::MongoDB

Download:
Entities-0.2.tar.gz

Dependencies

Annotate this POD

Website

CPAN RT

Open  0
View/Report Bugs
Module Version: 0.2   Source   Latest Release: Entities-0.5

NAME ^

Entities::Backend::MongoDB - Stores all Entities data in a MongoDB database.

VERSION ^

version 0.2

SYNOPSIS ^

        use Entities;
        use Entities::Backend::MongoDB;

        # see synopsis at L<Entities>

DESCRIPTION ^

This backend for the Entities user management and authorization system stores all entities and relations between them in a MongoDB database, using the MongoDB module. This is a powerful, fast backend that gives you all the features of MongoDB. This is the only backend right now that can be used in production environments.

A big advantage of using this backend is that there is no setup work necessary. Just make sure your MongoDB daemon is running, and this backend will automatically created the database and necessary collections.

UNIQUE METHODS ^

The following method are unique to this backend only.

new( [host => 'localhost', port => 27017, db_name => 'entities'] )

Creates a new instance of this module. Can receive the hostname of the server running the MongoDB daemon, the port on thiat host where the daemon is listening, and the name of the database to use. None of these parameters is required, host will default to 'localhost', port will default to 27017 (the default MongoDB port) and db_name will default to 'entities'.

host()

Returns the host name or IP of the MongoDB server.

port()

Returns the port number on the host where the MongoDB server listens.

db_name()

Returns the name of the database into which all data is saved.

db( [$db_obj] )

Returns the MongoDB::Database object used for actually storing and retrieving data. If a MongoDB::Database object is provided, it will replace the current object.

to_hash( $obj )

Receives an entity object (either user, action, role, feature, plan or customer) and turns it into a hash-ref that can be saved in the database.

METHODS IMPLEMENTED ^

The following methods implement the methods that the Entities::Backend Moose role requires backend classes to implement. See the documentation of that role for more information on these methods.

get_user_from_id( $user_id )

get_user_from_name( $username )

get_role( $role_name )

get_customer( $customer_name )

get_plan( $plan_name )

get_feature( $feature_name )

get_action( $action_name )

save( $obj )

METHOD MODIFIERS ^

The following list documents any method modifications performed through the magic of Moose.

BUILD()

This method is automatically invoked immediately after the new() method is invoked. It is used to initiate the connection to the MongoDB database and store it in the object.

SEE ALSO ^

Entities, Entities::Backend, Entities::Backend::Memory, MongoDB.

AUTHOR ^

Ido Perlmuter, <ido at ido50 dot net>

BUGS ^

Please report any bugs or feature requests to bug-entities at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Entities. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT ^

You can find documentation for this module with the perldoc command.

    perldoc Entities::Backend::MongoDB

You can also look for information at:

LICENSE AND COPYRIGHT ^

Copyright 2010 Ido Perlmuter.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.

syntax highlighting: