Fixing path to administrate view and added permission checks to controller

This commit is contained in:
Absurdon 2017-11-10 12:12:03 +01:00 committed by Absurdon
parent 29d447e97b
commit 0f0393ecc5
3 changed files with 5 additions and 1 deletions

View file

@ -1,9 +1,10 @@
class CustomUrlsController < ApplicationController class CustomUrlsController < ApplicationController
def administrate def administrate
raise AccessError unless cuser && cuser.admin?
end end
def create def create
raise AccessError unless request.xhr?
end end
def show def show
@ -15,8 +16,10 @@ class CustomUrlsController < ApplicationController
end end
def update def update
raise AccessError unless request.xhr?
end end
def destroy def destroy
raise AccessError unless request.xhr?
end end
end end

View file

@ -18,5 +18,6 @@
<li><%= link_to "Contests", contests_path %></li> <li><%= link_to "Contests", contests_path %></li>
<li><%= link_to "Challenges", challenges_path %></li> <li><%= link_to "Challenges", challenges_path %></li>
<li><%= link_to "Maps", maps_path %></li> <li><%= link_to "Maps", maps_path %></li>
<li><%= link_to "Custom Article URLs", custom_urls_path %></li>
</ul> </ul>
</div> </div>