- # the random nonce here which isn't predictable, making an CSRF
- # procedure much, much more difficult. setup the nonce. if the given
- # nonce matches the session nonce then yield into the actual method.
- # otherwise, just sets up the nonce for the form.
- def setup_nonce
- if params[:nonce] and params[:nonce] == session[:nonce]
- @nonce = params[:nonce]
- yield
- else
- @nonce = OAuth::Helper.generate_nonce
- session[:nonce] = @nonce
- render
+ # require that the user is an administrator, or fill out a helpful error message
+ # and return them to theuser page.
+ def require_administrator
+ unless current_user.administrator?
+ flash[:error] = t "user_role.filter.not_an_administrator"
+ redirect_to user_path(@user)