Open mlbriel opened 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.
I am referring to the following from documents_controller:
def show @document = Document.find(params[:id])
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?
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.
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 .
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> .
— Reply to this email directly or view it on GitHubhttps://github.com/dmeese/MathWorld/issues/25#issuecomment-10776618.
This function shows public content only(Authorization Level = 1). There is no method for displaying content with higher AuthorizationLevel.