The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Gantry::Control - The Core for User Management and Administration

SYNOPSIS

  use Gantry::Control;

  dec2bin
    ( $one, $two, $three ) = dec2bin( $bits );

  encrypt
    $encrypted = encrypt( $unencripted );

  get_grnam
    $gid = get_grnam( $dbh, $group_name );

  get_grgid
    $group_name = get_grgid( $dbh, $gid );

  get_pwnam
    ( $user_id, $active, $passwd, $first, $last, $email ) = 
      get_pwnam( $dbh, $user_name );

  get_pwuid
    ( $user_name, $active, $passwd, $first, $last, $email ) = 
      get_pwuid( $dbh, $user_id );

  get_usergrp
    $grp = get_usrgrp( $dbh, $uid );

DESCRIPTION

This module is a library of useful access functions that would be used in other handlers, it also details the other modules that belong to the Control tree.

FUNCTIONS

( $user, $group, $world ) = dec2bin( $bits )

This function decodes three digit permissions used by the page based authentication and management, the first value in the array is a boolean of the user permission. The second and third are for group and world respectively. All values are either '1' for they have permission or '0' for no permission.

$encrypted = encrypt( $unencripted )

This function is just a wrapper to the standard unix crypt so it can be easily used, and consitantly even.

$gid = get_grnam( $dbh, $group_name )

Finds a groups gid based on the group name.

$group_name = get_grgid( $dbh, $gid )

Finds a groups name based on the groups id.

@user_info = get_pwnam( $dbh, $user_name )

This emulates C's getpwnam save it operates on the database. The return values are, in this order: Users database id, a boolean for the active status of the user, the users password ( as kept in the database ), the users first name, the users last name, and the users email address.

@user_info = get_pwuid( $dbh, $user_id )

This emulates C's getpwuid save it operates on the database. The return values are, in this order: Users username, a boolean for the active status of the user, the users password ( as kept in the database ), the users first name, the users last name, and the users email address.

$grp = get_usrgrp( $dbh, $uid )

This function takes the database handle and a users id. It returns a hash reference of group ids to their name that the user is in.

MODULES

Gantry::Control::C::Access
Gantry::Control::C::Authen

This module allows authentication against a database. Woo.

Gantry::Control::C::Authz

This is a simple database driven autorization system. This module also details the other Authz modules in the library.

Gantry::Control::C::Groups

This controller module handles all of the group manipulation for the authorization and authentication handlers.

Gantry::Control::C::Pages

This controller module is the frontend for the Gantry::Control::Authz::PageBased authentication handler. One would specify pages as well as the permissions with this frontend module.

Gantry::Control::C::Users

This Handler manages users in the database to facilitate the use of that information for authentication, autorization, and use in applications. This replaces the use of htpasswd for user management and puts more information at the finger tips of the application.

SCHEMA FOR AUTH TABLES

    create sequence "auth_users";
    create table "auth_users" (
        "id"            int4 default nextval('auth_users_seq'::text) NOT NULL,
        "user_id"       int4 default currval('auth_users_seq') NOT NULL,
        "active"        bool,
        "user_name"     varchar,
        "passwd"        varchar,
        "crypt"         varchar,
        "first_name"    varchar,
        "last_name"     varchar,
        "email"         varchar,
        CONSTRAINT auth_users_pk PRIMARY KEY (user_id)
    );

    create sequence "auth_groups_seq";
    create table "auth_groups" (
        "id"            int4 default nextval('auth_groups_seq'::text) NOT NULL,
        "name"          varchar,
        "ident"         varchar,
        "description"   text
    );

    create sequence "auth_pages_seq";
    create table "auth_pages" (
        "id"            int4 default nextval('auth_pages_seq'::text) NOT NULL,
        "user_perm"     int4,
        "group_perm"    int4,
        "world_perm"    int4,
        "owner_id"      int4,
        "group_id"      int4,
        "uri"           varchar,
        "title"         varchar
    );

    create sequence "auth_group_members_seq";
    create table "auth_group_members" (
        "id" int4 default nextval('auth_group_members_seq'::text) NOT NULL,
        "user_id"   int4,
        "group_id"  int4
    );

SEE ALSO

Gantry(3)

AUTHOR

Tim Keefer <tkeefer@gmail.com> Nick Studt

COPYRIGHT

Copyright (C) 2005-6, Tim Keefer

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.6 or, at your option, any later version of Perl 5 you may have available.