# Copyright (c) 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: GroupUserQueryForm.pm,v 2.3 2009/12/30 21:58:31 moeller Exp $ package Bivio::Biz::Model::GroupUserQueryForm; use strict; use Bivio::Base 'Model.FilterQueryForm'; our($VERSION) = sprintf('%d.%02d', q$Revision: 2.3 $ =~ /\d+/g); my($_T) = b_use('FacadeComponent.Text'); sub get_privilege_role { my($self) = @_; return _role_map($self)->{$self->unsafe_get('b_privilege') || ''}; } sub internal_query_fields { return [ @{shift->SUPER::internal_query_fields(@_)}, [qw(b_privilege Text)], ]; } sub internal_roles { return b_use('Model.RoleBaseList')->ROLES_ORDER; } sub provide_select_choices { my($self) = @_; return [sort(keys(%{_role_map($self)}))]; } sub to_html { my($self, $v) = @_; return b_use('Bivio::HTML')->escape($v); } sub _role_map { my($self) = @_; return {map({ my($v) = $_T->get_from_source($self->req) ->unsafe_get_value('GroupUserList.privileges_name', $_->get_name); $v ? ($v => $_) : (); } @{$self->internal_roles})}; } 1;