Next:
Yawns::Poll
Previous:
Yawns::News
 [Table of Contents]

Yawns::Permissions



NAME

Yawns::Permissions - A module for working with user permissions.

SYNOPSIS

    #!/usr/bin/perl -w

    use Yawns::Permissions;
    use strict;

    my $user = Yawns::Permissions->new( username => 'Steve');

    # Can the user delete a user?
    my $has_delete = $user->check( priv => "delete_user" );

    # can the user approve/edit/reject articles?
    my $has_approve = $user->check( priv => "article_admin" );

DESCRIPTION

This module contains code for checking permissions of our site-users.

This code allows users to be tested for varying permission keys. For example before deleting a pending article we'd test that the caller has the permission "article_admin" - if they do we can proceed, if not we have an errant user.

The keys are deliberately text-based and cached since we assume that < 1% of users will be privileged.

new

  Create a new instance of this object.

check

  Determine whether the specified user has the specified privilege.

findWith

  Find all the users with the given permission key.

getKnownAttributes

  Return all the currently used permission keys

  This is just used for testing right now, however it will be used to
 allow users with "grant_privileges" ability to edit other users.

givePermission

  Grant the named user the specified permission key.

makeAdmin

  Make a user a *global* administrator.

removeAllPermissions

  Remove all special permissions the user might have.

invalidateCache

  Clean any cached content we might have.

[Top] Generated by HTML::FromPod 0.49 on Fri Nov 21 03:03:58 2008