NAME
Pangloss::User::Privileges - user privileges.
SYNOPSIS
use Pangloss::User::Privileges;
my $privs = new Pangloss::User::Privileges();
$privs->admin( false )
->add_concepts( true )
->add_categories( true )
->add_translate_languages( @languages )
->add_proofread_languages( @languages );
do { ... } if $privs->can_translate( $language );
do { ... } if $privs->can_proofread( $language );
do { ... } if $privs->admin();
# etc.
DESCRIPTION
This class represents the privileges of a user in Pangloss. A user with special privileges can do one or more of:
translate terms in a given language
proofread terms in a given language
add concepts
add categories
administrate Pangloss
New privileges are created with an empty list of translate/proofread languages.
This class inherits from Pangloss::StoredObject.
METHODS
- add_concepts()
-
set/get 'add concepts' flag of the user.
- add_categories()
-
set/get 'add categories' flag of the user.
- admin()
-
set/get administration flag of the user.
- translate_languages()
-
set/get hash of Pangloss::Language keys the user is allowed to translate.
- proofread_languages()
-
set/get hash of Pangloss::Language keys the user is allowed to proofread.
- translate(), proofread()
-
test to see if user can translate/proofread one or more <Pangloss::Language>s.
- add_translate_languages( @langs ), add_proofread_languages( @langs )
-
add to the relevant list of languages. accepts Pangloss::Languages or their keys. returns this object.
- remove_translate_languages( @langs ), remove_proofread_languages( @langs )
-
remove from the relevant list of languages. accepts Pangloss::Languages or their keys. returns this object.
- can_translate( $lang ), can_proofread( $lang )
-
test to see if user can translate/proofread given Pangloss::Language.
AUTHOR
Steve Purkis <spurkis@quiup.com>