Skip to content

Commit 0fa6f93

Browse files
committed
User index permissions
1 parent 3a5de0e commit 0fa6f93

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

app/controllers/users_controller.rb

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
class UsersController < InheritedController
22
load_and_authorize_resource
33
skip_authorize_resource :only => [:following, :followers] #anyone can perform these read-only actions
4+
45
require 'will_paginate/array'
56

67
def index
7-
@users = User.all.paginate(:page => params[:page], :per_page => 1)
8-
respond_to do |format|
9-
format.html
10-
end
8+
redirect_to root_path unless current_user and current_user.moderator
9+
@users = User.all.paginate(:page => params[:page], :per_page => 10)
1110
end
1211

1312
def follow

app/views/shared/menu/_user.html.haml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
= semantic_menu :class => "nav secondary-nav" do |root|
22
- if current_user
3+
- if current_user.moderator
4+
- root.add "Send an Email", users_index_path
35
- root.add current_user.username, user_path(current_user)
46
- root.add "Log Out", logout_path
57
- else

0 commit comments

Comments
 (0)