# Copyright (c) 2007 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: RealmFile.bunit,v 1.8 2008/09/19 01:00:57 aviggio Exp $ Request(); req()->set_realm_and_user('RealmFile2', undef); model('RealmFile') ->create_or_update_with_content({path => '/ARF/0'}, \('not to be found')); req()->set_realm_and_user('fourem'); foreach my $path (qw( /ARF/0 /Public/ARF.txt /Public/ARF_Public.txt /ARF_Private.txt /ARF.txt /Public/A.eml /Public/A.eml )) { model('RealmFile')->create_or_update_with_content({path => $path}, \$path); } commit(); options({ compute_params => sub { my($case, $params) = @_; req()->put(path_info => shift(@$params)); if ($case->get('method') =~ /^(access_controlled_execute|execute_show_original)$/) { req()->set_user(shift(@$params)); return [req()]; } return [req(), undef, req('auth_id'), @$params]; }, compute_return => sub { return [req('reply')->get_output]; }, }); [ class() => [ execute_private => [ '/ARF/0' => '/ARF/0', '/ARF' => MODEL_NOT_FOUND(), ], unauth_execute => [ ['/ARF/0'] => '/ARF/0', ['/Some/path', '/ARF/0'] => '/ARF/0', ['/ARF/0', '/not_found'] => MODEL_NOT_FOUND(), ], access_controlled_execute => [ '/ARF/0' => FORBIDDEN(), '/ARF.txt' => '/Public/ARF.txt', 'A.eml' => '/Public/A.eml', '/Archived/A;1.eml' => FORBIDDEN(), ], { method => 'execute_show_original', compute_return => sub { return [req('reply')->get_output_type, req('reply')->get_output, req('Model.RealmFile')->get_content_type]; }, } => [ '/A.eml' => ['text/plain', '/Public/A.eml', 'message/rfc822'], ], ], ];