Forum OpenACS Q&A: Re: How to force login for the Site?

Collapse
Posted by Andrew Piskorski on
No, but try looking in OpenACS for ns_register_filter examples:

$ cd packages
$ find . -name "*.tcl" -print | xargs grep ns_register_filter
./acs-tcl/tcl/request-processor-init.tcl:  ns_register_filter preauth $method /resources/* rp_resources_filter
./acs-tcl/tcl/request-processor-init.tcl:  ns_register_filter preauth $method * rp_filter
./acs-tcl/tcl/request-processor-init.tcl:	ns_register_filter $kind $method $path rp_invoke_filter \
./acs-bootstrap-installer/bootstrap.tcl:    ns_register_filter preauth GET * bootstrap_write_error
./acs-bootstrap-installer/bootstrap.tcl:    ns_register_filter preauth POST * bootstrap_write_error
./acs-bootstrap-installer/bootstrap.tcl:    ns_register_filter preauth HEAD * bootstrap_write_error

What you'll want is something like:

ns_register_filter preauth * {/my-php-pages/*.php} my_security_filter_proc

Your my_security_filter_proc will need to handle the security check, then redirect to the login page while passing the appropriate info so that after logging in, the login page will redirect the user back to where he wanted to go.