# Copyright (c) 2005-2009 bivio Software, Inc. All Rights Reserved. # # Visit http://www.bivio.biz for more info. # # This library is free software; you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as # published by the Free Software Foundation; either version 2.1 of the # License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; If not, you may get a copy from: # http://www.opensource.org/licenses/lgpl-license.html # # $Id: Role.pm,v 1.20 2011/01/08 14:56:28 nagler Exp $ package Bivio::Delegate::Role; use strict; use Bivio::Base 'Bivio.Delegate'; our($VERSION) = sprintf('%d.%02d', q$Revision: 1.20 $ =~ /\d+/g); my($_R) = b_use('Auth.Role'); sub get_application_specific_list { return grep($_->as_int > 19, $_R->get_non_zero_list); } sub get_delegate_info { return [ UNKNOWN => 0, # user not supplied with request or unable to authenticate ANONYMOUS => 1, # privileges of any authenticated user, not particular to real USER => 2, WITHDRAWN => 3, GUEST => 4, MEMBER => 5, ACCOUNTANT => 6, ADMINISTRATOR => 7, MAIL_RECIPIENT => 8, FILE_WRITER => 9, UNAPPROVED_APPLICANT => 10, # LAST_RESERVED => 19, ]; } sub get_main_list { return map($_R->unsafe_from_name($_) ? $_R->$_() : (), qw( ADMINISTRATOR ACCOUNTANT MEMBER GUEST WITHDRAWN )); } sub internal_category_role_group_map { return { nobody => [], all_admins => [qw(ACCOUNTANT ADMINISTRATOR)], all_members => [qw(all_admins MEMBER)], all_guests => [qw(all_members GUEST)], all_users => [qw(all_guests WITHDRAWN UNAPPROVED_APPLICANT USER)], everybody => [qw(all_users ANONYMOUS)], }; } 1;