Sha256: 44793ca4ada0033f5ab12864852f0649c928d212939887964cfcec7663add3ed

Contents?: true

Size: 714 Bytes

Versions: 4

Compression:

Stored size: 714 Bytes

Contents

module Vhost::AdminUsersControllerExtensions
  def self.included(receiver)
    receiver.send  :only_allow_access_to, :index, :show, :new, :create, :edit, :update, :remove, :destroy,
      :when => [:admin, :site_admin], 
      :denied_url => { :controller => 'pages', :action => 'index' },
      :denied_message => 'You must have administrative privileges to perform this action.'

    receiver.class_eval {
      def load_model
        self.model = if params[:id]
          model_class.find(params[:id], :readonly => false)
        else
          model_class.new
        end
      end
      
      def load_models
        self.models = current_site.users.paginate(pagination_parameters)
      end
    }
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
radiant-vhost-extension-2.3.1 lib/vhost/admin_users_controller_extensions.rb
radiant-vhost-extension-2.3.0 lib/vhost/admin_users_controller_extensions.rb
radiant-vhost-extension-2.2.0 lib/vhost/admin_users_controller_extensions.rb
radiant-vhost-extension-2.1.0 lib/vhost/admin_users_controller_extensions.rb