dmeese / MathWorld

Team Bunny Slippers Math World Web Application
0 stars 1 forks source link

In documents_controller – show method : supports only public documents #25

Open mlbriel opened 11 years ago

mlbriel commented 11 years ago

This function shows public content only(Authorization Level = 1). There is no method for displaying content with higher AuthorizationLevel.

dmeese commented 11 years ago

It's not clear what you mean by this. Registered but unverified users only have access to public content by design. Users with student or higher access (Auth level 2-4) can see non-public content.

mlbriel commented 11 years ago

I am referring to the following from documents_controller:

def show @document = Document.find(params[:id])

This shows only public content to non-logged inusers

if (@loggedinuser && @loggedinuser.authorizationlevel >= 1 ) || @document.authorizationlevel == 1
  respond_to do |format|
    format.html # show.html.erb
    format.json { render json: @document }
  end
else
   redirect_to '/'
end

end

Is there another function that shows the restricted content to logged in users?

dmeese commented 11 years ago

Yes. Rails uses a Model-View-Controller framework to present the application. What you see in the controller is only part of it. Where you see show.html.erb is a reference to the view which can be found here: https://github.com/dmeese/MathWorld/blob/Release/app/views/documents/show.html.erb

It's an erb file - Embedded ruby. Rails uses this page to generate the view for showing the document list. The <% %> syntax is embedded ruby, and this is the logic that allows it to display the appropriate content based on the user auth type.

For every controller, there is a defined view, and the view file can be found in /apps/views//

Part of the problem is that while you guys created accounts, they weer never validated so you could upload content. If you create an account, send me teh account name and I'll elevate priveleges to admin so you can use it to create test accounts.

mlbriel commented 11 years ago

Thanks,

I didn’t try any hand-on testing on the application. All the items I submitted were based on review of the source code. Didn’t hit the .erb files as I was not aware that there was code there also.

First time I have encountered Ruby or Rails so this was a bit alien.

Marc

From: noreply@github.com [mailto:noreply@github.com] On Behalf Of David Meese Sent: Tuesday, November 27, 2012 1:46 PM To: dmeese/MathWorld Cc: Briel, Marc L. Subject: Re: [MathWorld] 5. In documents_controller – show method : supports only public documents (#25)

Yes. Rails uses a Model-View-Controller framework to present the application. What you see in the controller is only part of it. Where you see show.html.erb is a reference to the view which can be found here: https://github.com/dmeese/MathWorld/blob/Release/app/views/documents/show.html.erb

It's an erb file - Embedded ruby. Rails uses this page to generate the view for showing the document list. The <% %> syntax is embedded ruby, and this is the logic that allows it to display the appropriate content based on the user auth type.

For every controller, there is a defined view, and the view file can be found in /apps/views//

Part of the problem is that while you guys created accounts, they weer never validated so you could upload content. If you create an account, send me teh account name and I'll elevate priveleges to admin so you can use it to create test accounts.

— Reply to this email directly or view it on GitHub https://github.com/dmeese/MathWorld/issues/25#issuecomment-10770898 .

https://github.com/notifications/beacon/p92lpI9pU_cxSxMTq8L-wtb2F6sRebSI6We8tL7M7rxpKQEOY_rlDNVoZAruo3lx.gif

dmeese commented 11 years ago

Yes. Rails is definitely different. We spent a lot of time reading the rails tutorial that is referenced in the wiki. There is a 'Rails Way' of doing things, and if you follow it, Rails makes it very easy to get things done.

On Tue, Nov 27, 2012 at 3:58 PM, mlbriel notifications@github.com wrote:

Thanks,

I didn’t try any hand-on testing on the application. All the items I submitted were based on review of the source code. Didn’t hit the .erb files as I was not aware that there was code there also.

First time I have encountered Ruby or Rails so this was a bit alien.

Marc

From: noreply@github.com [mailto:noreply@github.com] On Behalf Of David Meese Sent: Tuesday, November 27, 2012 1:46 PM To: dmeese/MathWorld Cc: Briel, Marc L. Subject: Re: [MathWorld] 5. In documents_controller – show method : supports only public documents (#25)

Yes. Rails uses a Model-View-Controller framework to present the application. What you see in the controller is only part of it. Where you see show.html.erb is a reference to the view which can be found here:

https://github.com/dmeese/MathWorld/blob/Release/app/views/documents/show.html.erb

It's an erb file - Embedded ruby. Rails uses this page to generate the view for showing the document list. The <% %> syntax is embedded ruby, and this is the logic that allows it to display the appropriate content based on the user auth type.

For every controller, there is a defined view, and the view file can be found in /apps/views//

Part of the problem is that while you guys created accounts, they weer never validated so you could upload content. If you create an account, send me teh account name and I'll elevate priveleges to admin so you can use it to create test accounts.

— Reply to this email directly or view it on GitHub < https://github.com/dmeese/MathWorld/issues/25#issuecomment-10770898> .

< https://github.com/notifications/beacon/p92lpI9pU_cxSxMTq8L-wtb2F6sRebSI6We8tL7M7rxpKQEOY_rlDNVoZAruo3lx.gif>

— Reply to this email directly or view it on GitHubhttps://github.com/dmeese/MathWorld/issues/25#issuecomment-10776618.