[jifty-devel] Admin mode breaks application.
Jesse Vincent
jesse at bestpractical.com
Thu May 25 13:42:51 EDT 2006
Mat,
I think the issue you're running into is that you've turned off Admin
mode.
Admin mode changes Jifty's default authorization strategy.
If you have a look at Jifty::Record, you'll see that we have a method
called "current_user_can". In admin mode, the answer to "Can the
current user _____" is always YES! In production, you often want a
somewhat more restrictive access control strategy, so Jifty defaults to
"no!" unless the current user is an administrator. You can change this
by overriding current_user_can in YourApp::Record.
Best,
Jesse
On Tue, May 23, 2006 at 11:27:32AM -0700, Mat Brletic wrote:
> Hello,
>
> A few days ago, I had a simple Jifty app working ok. I then went on to
> re-compile Apache to use mod_auth_ldap. When I tried to run the
> application again, I found that it did not work. I will paste the code
> below:
>
> --------------------------------------------------------------------
> code begins below
>
> <&|/_elements/wrapper, title => Jifty->config->framework('Survey3') &>
> % my $answers = Survey::Model::AnswerCollection->new();
> % $answers->unlimit();
> % my $next_answer_id = 0;
>
> % my $surveys = Survey::Model::SurveyCollection->new();
> % $surveys->unlimit();
> % my $next_survey_id = 0;
>
> % my $action = 'test_Answer_Survey.pm';
>
> % while (my $answer = $answers->next) {
> Survey: <% $answer->survey %>
> Answer ID: <% $answer->id %>
> Answer: <% $answer->answer %><br>
>
> % $next_answer_id = $next_answer_id + 1;
> % }
> %####################################################
> % while (my $survey = $surveys->next) {
> Survey ID: <% $survey->id %>
> Ticket # <% $survey->ticket %>
> Queue: <% $survey->queue %><br>
> % $next_survey_id = $next_survey_id + 1;
> % }
> %####################################################
>
> % $next_answer_id = $next_answer_id + 1;
>
> The next available survey ID number is : <% $next_survey_id %><br>
> The next available answer ID number is : <% $next_answer_id %><br>
> Please answer a few question about <b>Ticket # <% $ticket %></b> concerning
> Subject: <b><% $subject %></b><br>
>
> ----------------------------------------------------------
> ----------------------------------------------------------
>
> %#########################################################
> <FORM ACTION="test_Answer_Survey.pm">
>
> <<<<< removed for brevity, this was not part of problem>>>
>
>
> <INPUT TYPE=SUBMIT VALUE="Submit Survey">
> </FORM>
>
> </&>
> %#########################################################
>
> <%args>
> $ticket => ''
> $subject => ''
> $cue => ''
> </%args>
>
> -------------------------------------------- end of code
>
> What was happening was that Neither of the loops would run. The "next
> available" survey id and answer id would be 0 and 1, when they should
> have been much higher. It looked like local variables were not loading
> anything from the collection objects.
>
> Finally, I re-enable the Administration mode in config.yml, which I had
> set to zero in the process of re-building Apache and trying to clean
> things up. When I reset the Admin mode to 1, the application started
> working again.
>
> I cannot have administration mode active when the application is put
> into service, so if anyone knows what might be done to do to get the app
> working with Admin mode =0, I would appreciate the help.
>
> Thanks,
>
> Mat
>
>
> _______________________________________________
> jifty-devel mailing list
> jifty-devel at lists.jifty.org
> http://lists.jifty.org/cgi-bin/mailman/listinfo/jifty-devel
>
--
More information about the jifty-devel
mailing list