| Next: Yawns::Poll | Previous: Yawns::News | [Table of Contents] |
Yawns::Permissions - A module for working with user permissions.
#!/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" );
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.
Create a new instance of this object.
Determine whether the specified user has the specified privilege.
Find all the users with the given permission key.
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.
Grant the named user the specified permission key.
Make a user a *global* administrator.
Remove all special permissions the user might have.
Clean any cached content we might have.