Help with accessing system
I need some advice on implementing an accessing system. I have already implemented a few systems that now require some sort of advance accessing mechanism. I say advance because some parts of the systems that I have written are accessible by all, and some other parts should be accessible by managers, and still some other parts accessible by even fewer people. Not only that, I am also required to determine the identity of the user (not very challenging here), but to display the methods (links, buttons, ...) that the user with his/her access level can use and click on. I am hoping for some suggestions. All comments welcomed. Thanks in advance -r
Re: Help with accessing system
Hi Rasoul, You may want to try Metadot for a framework that takes care of all that for you. Metadot is a GPL'd mod_perl application that provides user management, content management and access control all in one package. It provides an API that allows for the creation of pluggable apps that take advantage of said infrastructure, so you can focus on developing the particularities of your app and not so much on infrastructure. All infrastructure is accesible from a web browser. The permissions system, for instance provides a GUI that allows to attach permissions and ACLs (access control lists) to individual units of content for groups and for individual users. (ie. you can specify separate permissions for the different operations of your unit of content. eg. a 'Poll' unit of content can be set to grant voting rights to the members of group X, edit rights to 'John' and 'View Results' to the members of group Y. Metadot is available from http://www.metadot.com or from http://sourceforge.net/projects/metadot. Regards, Claudio Garcia Rasoul Hajikhani wrote: I need some advice on implementing an accessing system. I have already implemented a few systems that now require some sort of advance accessing mechanism. I say advance because some parts of the systems that I have written are accessible by all, and some other parts should be accessible by managers, and still some other parts accessible by even fewer people. Not only that, I am also required to determine the identity of the user (not very challenging here), but to display the methods (links, buttons, ...) that the user with his/her access level can use and click on. I am hoping for some suggestions. All comments welcomed. Thanks in advance -r
perl timestamps
i didn't run into this until munging code via mod_perl and postgresql, so i figured this was a good place to ask a perl-generic question--if not, please point the way: print scalar localtime -123456789; Tue Feb 1 20:26:51 1966 print scalar localtime -1234567890; Mon Nov 17 18:28:30 1930 print scalar localtime -21; Tue Jun 16 04:40:00 1903 so since linux (debian potato) can grok timestamps before 1970 (as negative values, which makes quite some sense) then does it not make sense for Time::Local to allow Time::Local::timelocal(0,0,0,7,11,1941) # 7 dec '41 or Time::Local::timelocal(0,0,0,30,9,1929) # 30 oct '29 ? or, what alternative is there (aside from munging the Time::Local code itself)? -- [EMAIL PROTECTED] http://sourceforge.net/projects/newbiedoc -- we need your brain! http://www.dontUthink.com/ -- your brain needs us!
cvs commit: modperl-2.0/t/protocol/TestProtocol eliza.pm
stas01/09/05 19:45:13 Added: t/protocol eliza.t t/protocol/TestProtocol eliza.pm Log: now we have our own Rogerian psychotherapist overlooking our test suite :) Revision ChangesPath 1.1 modperl-2.0/t/protocol/eliza.t Index: eliza.t === use strict; use warnings FATAL = 'all'; use Apache::Test; use Apache::TestRequest (); my @test_strings = ('Hello Eliza', 'How are you', 'Why do I have core dumped?', 'I feel like writing some tests today, you?', 'good bye'); plan tests = 1 + @test_strings, test_module 'Chatbot::Eliza'; my $socket = Apache::TestRequest::vhost_socket('TestProtocol::eliza'); ok $socket; for (@test_strings) { print SEND ='$_'\n; print $socket $_\n; chomp(my $reply = $socket); print REPLY='$reply'\n; ok $reply; } 1.1 modperl-2.0/t/protocol/TestProtocol/eliza.pm Index: eliza.pm === package TestProtocol::eliza; use strict; use Apache::Connection (); use APR::Socket (); require Chatbot::Eliza; use constant BUFF_LEN = 1024; my $mybot = new Chatbot::Eliza; sub handler { my Apache::Connection $c = shift; my APR::Socket $socket = $c-client_socket; my $buff; my $last = 0; for (;;) { my($rlen, $wlen); my $rlen = BUFF_LEN; $socket-recv($buff, $rlen); last if $rlen = 0; $last++ if $buff eq 'good bye'; $buff = $mybot-transform( $buff ) . \n; $socket-send($buff, length $buff); last if $last; } return 0; } 1;
cvs commit: modperl-2.0/t/conf extra.conf.in
stas01/09/05 21:58:43 Modified:perl-framework/Apache-Test/lib/Apache TestConfig.pm Added: t/conf extra.conf.in Log: put -T switch into the correct config file Revision ChangesPath 1.53 +0 -3 httpd-test/perl-framework/Apache-Test/lib/Apache/TestConfig.pm Index: TestConfig.pm === RCS file: /home/cvs/httpd-test/perl-framework/Apache-Test/lib/Apache/TestConfig.pm,v retrieving revision 1.52 retrieving revision 1.53 diff -u -r1.52 -r1.53 --- TestConfig.pm 2001/09/06 02:36:44 1.52 +++ TestConfig.pm 2001/09/06 04:58:43 1.53 @@ -940,9 +940,6 @@ HostnameLookups Off -# make sure that we test under Taint mode -PerlSwitches -T - Directory / Options FollowSymLinks AllowOverride None 1.1 modperl-2.0/t/conf/extra.conf.in Index: extra.conf.in === # make sure that we test under Taint mode PerlSwitches -T
cvs commit: modperl-2.0/xs/tables/current/ModPerl FunctionTable.pm
stas01/09/05 22:05:47 Modified:perl-framework/Apache-Test/lib/Apache TestConfigPerl.pm TestTrace.pm lib/Apache ParseSource.pm todo missing_old_features.txt xs/tables/current/Apache ConstantsTable.pm FunctionTable.pm StructureTable.pm xs/tables/current/ModPerl FunctionTable.pm Added: perl-framework/Apache-Test/lib/Apache TestUtil.pm Log: Apache-Test/lib/Apache/TestUtil.pm Revision ChangesPath 1.21 +10 -3 httpd-test/perl-framework/Apache-Test/lib/Apache/TestConfigPerl.pm Index: TestConfigPerl.pm === RCS file: /home/cvs/httpd-test/perl-framework/Apache-Test/lib/Apache/TestConfigPerl.pm,v retrieving revision 1.20 retrieving revision 1.21 diff -u -r1.20 -r1.21 --- TestConfigPerl.pm 2001/08/27 17:13:26 1.20 +++ TestConfigPerl.pm 2001/09/06 05:05:46 1.21 @@ -245,11 +245,18 @@ my @args; my $pm = $_; -my $module = catfile $File::Find::dir, $pm; -$self-add_module_config($module, \@args); -$module = abs2rel $module, $dir; +my $file = catfile $File::Find::dir, $pm; +$self-add_module_config($file, \@args); +my $module = abs2rel $file, $dir; $module =~ s,\.pm$,,; $module = join '::', splitdir $module; + +#require $file; +#my $configure_sub = \{$module.::APACHE_TEST_CONFIGURE}; +#if ($configure_sub) { +#eval {$self-$configure_sub}; +#warn $@ if $@; +#} my($base, $sub) = map { s/^test//i; $_ } split '::', $module; 1.5 +1 -0 httpd-test/perl-framework/Apache-Test/lib/Apache/TestTrace.pm Index: TestTrace.pm === RCS file: /home/cvs/httpd-test/perl-framework/Apache-Test/lib/Apache/TestTrace.pm,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- TestTrace.pm 2001/08/31 00:47:56 1.4 +++ TestTrace.pm 2001/09/06 05:05:46 1.5 @@ -1,6 +1,7 @@ package Apache::TestTrace; use strict; +use warnings FATAL = 'all'; use Exporter (); our (@Levels, @Utils); 1.1 httpd-test/perl-framework/Apache-Test/lib/Apache/TestUtil.pm Index: TestUtil.pm === package Apache::TestUtil; use strict; use warnings FATAL = 'all'; use File::Find (); use File::Path (); use Exporter (); our $VERSION = '0.01'; our @ISA = qw(Exporter); our @EXPORT = qw(t_cmp t_write_file t_open_file t_mkdir t_rm_tree); our %CLEAN = (); # t_cmp($expect,$received,$comment) # returns the result of comparison of $expect and $received # first prints all the arguments for debug. ## sub t_cmp { my ($expect, $received, $comment) = @_; print testing : $comment\n if defined $comment; print expected: $expect\n; print received: $received\n; $expect eq $received; } # t_write_file($filename,@lines); # the file will be deleted at the end of the tests run # sub t_write_file { my $file = shift; open my $fh, , $file or die can't open $file: $!; print writing file: $file\n; print $fh join '', @_ if @_; close $fh; $CLEAN{files}{$file}++; } # t_open_file($filename); # open a file for writing and return the open fh # the file will be deleted at the end of the tests run sub t_open_file { my $file = shift; open my $fh, , $file or die can't open $file: $!; print writing file: $file\n; $CLEAN{files}{$file}++; return $fh; } # t_mkdir($dirname) # create a dir # the dir will be deleted at the end of the tests run sub t_mkdir { my $dir = shift; mkdir $dir, 0755 unless -d $dir; print creating dir: $dir\n; $CLEAN{dirs}{$dir}++; } # deletes the whole tree(s) or just file(s) # accepts a list of dirs to delete ### sub t_rm_tree { File::Path::rmtree((@_ 1 ? \@_ : $_[0]), 0, 1); } END{ # cleanup first files than dirs map { unlink $_ } grep {-e $_ -f _ } keys %{ $CLEAN{files} }; map { t_rm_tree($_) } grep {-e $_ -d _ } keys %{ $CLEAN{dirs} }; } 1; __END__ =head1 NAME Apache::TestUtil - Utilities for writing tests =head1 SYNOPSIS =head1 DESCRIPTION =cut 1.24 +33 -6 modperl-2.0/lib/Apache/ParseSource.pm Index: ParseSource.pm === RCS file:
cvs commit: modperl-2.0/xs/tables/current/ModPerl FunctionTable.pm
stas01/09/05 22:16:25 Modified:perl-framework/Apache-Test/lib/Apache TestConfigPerl.pm xs/tables/current/Apache ConstantsTable.pm FunctionTable.pm StructureTable.pm xs/tables/current/ModPerl FunctionTable.pm Log: reverting a stray commit :( sorry Revision ChangesPath 1.22 +3 -10 httpd-test/perl-framework/Apache-Test/lib/Apache/TestConfigPerl.pm Index: TestConfigPerl.pm === RCS file: /home/cvs/httpd-test/perl-framework/Apache-Test/lib/Apache/TestConfigPerl.pm,v retrieving revision 1.21 retrieving revision 1.22 diff -u -r1.21 -r1.22 --- TestConfigPerl.pm 2001/09/06 05:05:46 1.21 +++ TestConfigPerl.pm 2001/09/06 05:16:25 1.22 @@ -245,18 +245,11 @@ my @args; my $pm = $_; -my $file = catfile $File::Find::dir, $pm; -$self-add_module_config($file, \@args); -my $module = abs2rel $file, $dir; +my $module = catfile $File::Find::dir, $pm; +$self-add_module_config($module, \@args); +$module = abs2rel $module, $dir; $module =~ s,\.pm$,,; $module = join '::', splitdir $module; - -#require $file; -#my $configure_sub = \{$module.::APACHE_TEST_CONFIGURE}; -#if ($configure_sub) { -#eval {$self-$configure_sub}; -#warn $@ if $@; -#} my($base, $sub) = map { s/^test//i; $_ } split '::', $module; 1.14 +1 -1 modperl-2.0/xs/tables/current/Apache/ConstantsTable.pm Index: ConstantsTable.pm === RCS file: /home/cvs/modperl-2.0/xs/tables/current/Apache/ConstantsTable.pm,v retrieving revision 1.13 retrieving revision 1.14 diff -u -r1.13 -r1.14 --- ConstantsTable.pm 2001/09/06 05:05:46 1.13 +++ ConstantsTable.pm 2001/09/06 05:16:25 1.14 @@ -2,7 +2,7 @@ # !! # ! WARNING: generated by Apache::ParseSource/0.02 -# ! Wed Aug 29 00:18:55 2001 +# ! Sun Aug 19 11:43:53 2001 # ! do NOT edit, any changes will be lost ! # !! 1.16 +22 -429 modperl-2.0/xs/tables/current/Apache/FunctionTable.pm Index: FunctionTable.pm === RCS file: /home/cvs/modperl-2.0/xs/tables/current/Apache/FunctionTable.pm,v retrieving revision 1.15 retrieving revision 1.16 diff -u -r1.15 -r1.16 --- FunctionTable.pm 2001/09/06 05:05:46 1.15 +++ FunctionTable.pm 2001/09/06 05:16:25 1.16 @@ -2,7 +2,7 @@ # !! # ! WARNING: generated by Apache::ParseSource/0.02 -# ! Wed Aug 29 00:20:03 2001 +# ! Sun Aug 19 10:32:09 2001 # ! do NOT edit, any changes will be lost ! # !! @@ -554,26 +554,6 @@ ] }, { -'return_type' = 'apr_port_t', -'name' = 'ap_default_port_for_request', -'args' = [ - { -'type' = 'const request_rec *', -'name' = 'r' - } -] - }, - { -'return_type' = 'apr_port_t', -'name' = 'ap_default_port_for_scheme', -'args' = [ - { -'type' = 'const char *', -'name' = 'scheme_str' - } -] - }, - { 'return_type' = 'const char *', 'name' = 'ap_default_type', 'args' = [ @@ -609,16 +589,6 @@ }, { 'return_type' = 'int', -'name' = 'ap_directory_walk', -'args' = [ - { -'type' = 'request_rec *', -'name' = 'r' - } -] - }, - { -'return_type' = 'int', 'name' = 'ap_discard_request_body', 'args' = [ { @@ -747,16 +717,6 @@ ] }, { -'return_type' = 'int', -'name' = 'ap_file_walk', -'args' = [ - { -'type' = 'request_rec *', -'name' = 'r' - } -] - }, - { 'return_type' = 'apr_status_t', 'name' = 'ap_filter_flush', 'args' = [ @@ -1585,11 +1545,6 @@ 'args' = [] }, { -'return_type' = 'apr_array_header_t *', -'name' = 'ap_hook_get_map_to_storage', -'args' = [] - }, - { 'return_type' = 'void', 'name' = 'ap_hook_get_mgmt_items', 'args' = [ @@ -1800,28 +1755,6 @@ }, { 'return_type' = 'void', -'name' = 'ap_hook_map_to_storage', -'args' = [ - { -'type' = 'ap_HOOK_map_to_storage_t *', -'name' = 'pf' - }, - { -'type' = 'const char *
cvs commit: modperl-2.0/src/modules/perl modperl_cmd.h
stas01/09/05 23:00:08 Modified:src/modules/perl modperl_cmd.h Log: new TAKE wrappers for the Perl{Set|Pass}Env and a new DECLARE wrapper for 'directive key val' Revision ChangesPath 1.6 +11 -0 modperl-2.0/src/modules/perl/modperl_cmd.h Index: modperl_cmd.h === RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_cmd.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- modperl_cmd.h 2001/08/08 07:02:41 1.5 +++ modperl_cmd.h 2001/09/06 06:00:08 1.6 @@ -8,6 +8,9 @@ #define MP_CMD_SRV_DECLARE(item) \ const char *modperl_cmd_##item(cmd_parms *parms, \ void *dummy, const char *arg) +#define MP_CMD_SRV_DECLARE2(item) \ +const char *modperl_cmd_##item(cmd_parms *parms, \ + void *dummy, const char *arg1, const char *arg2) MP_CMD_SRV_DECLARE(trace); MP_CMD_SRV_DECLARE(switches); MP_CMD_SRV_DECLARE(modules); @@ -43,12 +46,20 @@ AP_INIT_TAKE1( name, modperl_cmd_##item, NULL, \ RSRC_CONF, desc ) +#define MP_CMD_SRV_TAKE2(name, item, desc) \ +AP_INIT_TAKE2( name, modperl_cmd_##item, NULL, \ + RSRC_CONF, desc ) + #define MP_CMD_SRV_ITERATE(name, item, desc) \ AP_INIT_ITERATE( name, modperl_cmd_##item, NULL, \ RSRC_CONF, desc ) #define MP_CMD_DIR_TAKE1(name, item, desc) \ AP_INIT_TAKE1( name, modperl_cmd_##item, NULL, \ + OR_ALL, desc ) + +#define MP_CMD_DIR_TAKE2(name, item, desc) \ +AP_INIT_TAKE2( name, modperl_cmd_##item, NULL, \ OR_ALL, desc ) #define MP_CMD_DIR_ITERATE(name, item, desc) \