rosa-build/app/controllers/private_users_controller.rb

21 lines
680 B
Ruby

class PrivateUsersController < ApplicationController
before_filter :authenticate_user!
before_filter :check_global_access
def index
@private_users = PrivateUser.where(:platform_id => params[:platform_id]).paginate :page => params[:page]
@platform = Platform.find(params[:platform_id])
end
def create
pair = PrivateUser.generate_pair(params[:platform_id], current_user.id)
redirect_to platform_private_users_path(params[:platform_id]),
:notice => "Логин: #{ pair[:login] } Пароль: #{ pair[:pass] }"
end
def destroy
PrivateUser.find(params[:id]).destroy
redirect_to platform_private_users_path(params[:platform_id])
end
end