radmin 0.2.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.rvmrc +1 -0
- data/app/controllers/radmin/dashboards_controller.rb +2 -0
- data/app/controllers/radmin/passwords_controller.rb +4 -0
- data/app/controllers/{admin → radmin}/sessions_controller.rb +3 -3
- data/app/controllers/{admin → radmin}/settings_controller.rb +2 -16
- data/app/controllers/{admin → radmin}/users_controller.rb +4 -16
- data/app/controllers/radmin_controller.rb +13 -0
- data/app/helpers/{admin_helper.rb → radmin_helper.rb} +5 -1
- data/app/views/layouts/{admin.html.haml → radmin.html.haml} +1 -1
- data/app/views/radmin/dashboards/_dashboard.html.haml +2 -0
- data/app/views/radmin/dashboards/show.html.haml +2 -0
- data/app/views/{admin → radmin}/passwords/edit.html.haml +0 -2
- data/app/views/{admin → radmin}/passwords/new.html.haml +0 -1
- data/app/views/{admin → radmin}/sessions/new.html.haml +0 -0
- data/app/views/{admin → radmin}/settings/_form.html.haml +0 -0
- data/app/views/{admin → radmin}/settings/edit.html.haml +0 -0
- data/app/views/{admin → radmin}/settings/index.html.haml +5 -4
- data/app/views/{admin → radmin}/settings/new.html.haml +0 -0
- data/app/views/{admin → radmin}/users/_form.html.haml +1 -4
- data/app/views/{admin → radmin}/users/edit.html.haml +0 -0
- data/app/views/{admin → radmin}/users/index.html.haml +5 -4
- data/app/views/{admin → radmin}/users/new.html.haml +0 -0
- data/config/authorization.rb +10 -0
- data/config/routes.rb +4 -4
- data/lib/generators/radmin/install_generator.rb +0 -4
- data/lib/radmin.rb +6 -3
- data/lib/radmin/admin_ui.rb +13 -13
- data/lib/radmin/authorization.rb +47 -0
- data/lib/radmin/engine.rb +10 -2
- data/lib/radmin/version.rb +1 -1
- data/radmin.gemspec +3 -3
- data/spec/dummy/config/locales/devise.en.yml +50 -0
- metadata +100 -107
- data/app/controllers/admin/accounts_controller.rb +0 -16
- data/app/controllers/admin/passwords_controller.rb +0 -4
- data/app/controllers/admin_controller.rb +0 -15
- data/app/views/admin/accounts/edit.html.haml +0 -11
- data/lib/generators/radmin/templates/authorization_rules.rb +0 -17
- data/spec/dummy/config/authorization_rules.rb +0 -17
data/.rvmrc
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
rvm use 1.9.2-p290@radmin --create
|
@@ -1,15 +1,6 @@
|
|
1
|
-
class
|
2
|
-
|
3
|
-
filter_access_to [:index,:new,:create,:edit,:update,:destroy]
|
1
|
+
class Radmin::SettingsController < RadminController
|
2
|
+
load_and_authorize_resource :class => "Radmin::Setting"
|
4
3
|
|
5
|
-
def index
|
6
|
-
@settings = Radmin::Setting.all
|
7
|
-
end
|
8
|
-
|
9
|
-
def new
|
10
|
-
@setting = Radmin::Setting.new
|
11
|
-
end
|
12
|
-
|
13
4
|
def create
|
14
5
|
Radmin::Setting["#{params[:setting]['key']}"] = params[:setting]['value']
|
15
6
|
flash[:notice] = Radmin::I18n.t(:setting_sucessfully_created, :default => "Setting sucessfully created.")
|
@@ -32,9 +23,4 @@ class Admin::SettingsController < AdminController
|
|
32
23
|
flash[:notice] = Radmin::I18n.t(:setting_sucessfully_deleted, :default => "Setting sucessfully deleted.")
|
33
24
|
redirect_to admin_settings_url
|
34
25
|
end
|
35
|
-
|
36
|
-
protected
|
37
|
-
def find_setting
|
38
|
-
@setting = Radmin::Setting.find(params[:id])
|
39
|
-
end
|
40
26
|
end
|
@@ -1,18 +1,11 @@
|
|
1
|
-
class
|
2
|
-
|
3
|
-
filter_access_to [:index,:new,:create]
|
4
|
-
filter_access_to [:edit,:update,:destroy], :attribute_check => true, :load_method => lambda { |c| @user = Radmin::User.find(params[:id]) }
|
1
|
+
class Radmin::UsersController < RadminController
|
2
|
+
load_and_authorize_resource :class => "Radmin::User"
|
5
3
|
|
6
|
-
def index
|
7
|
-
@users =
|
8
|
-
end
|
9
|
-
|
10
|
-
def new
|
11
|
-
@user = Radmin::User.new
|
4
|
+
def index
|
5
|
+
@users = @users.includes(:roles)
|
12
6
|
end
|
13
7
|
|
14
8
|
def create
|
15
|
-
@user = Radmin::User.new(params[:user])
|
16
9
|
if @user.save
|
17
10
|
redirect_to(admin_users_url, :notice => Radmin::I18n.t(:account_created, :default => "Account created."))
|
18
11
|
else
|
@@ -35,9 +28,4 @@ class Admin::UsersController < AdminController
|
|
35
28
|
@user.destroy
|
36
29
|
redirect_to(admin_users_url, :notice => Radmin::I18n.t(:account_deleted, :default => "Account deleted."))
|
37
30
|
end
|
38
|
-
|
39
|
-
protected
|
40
|
-
def load_user
|
41
|
-
@user = Radmin::User.find(params[:id])
|
42
|
-
end
|
43
31
|
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
class RadminController < ApplicationController
|
2
|
+
helper :radmin
|
3
|
+
before_filter :authenticate_admin!
|
4
|
+
layout "radmin"
|
5
|
+
|
6
|
+
rescue_from CanCan::AccessDenied do |exception|
|
7
|
+
redirect_to admin_dashboard_url, :alert => exception.message
|
8
|
+
end
|
9
|
+
|
10
|
+
def current_ability
|
11
|
+
@current_ability ||= Radmin::Authorization.new(current_admin)
|
12
|
+
end
|
13
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
module
|
1
|
+
module RadminHelper
|
2
2
|
def current_url?(options)
|
3
3
|
url = case options
|
4
4
|
when Hash
|
@@ -42,4 +42,8 @@ module AdminHelper
|
|
42
42
|
def show_title?
|
43
43
|
@show_title
|
44
44
|
end
|
45
|
+
|
46
|
+
def has_role?(role)
|
47
|
+
current_admin.role_symbols.include?(role.to_sym)
|
48
|
+
end
|
45
49
|
end
|
@@ -24,7 +24,7 @@
|
|
24
24
|
%span.nodisp
|
25
25
|
#usernav
|
26
26
|
= Radmin::I18n.t(:logged_in_as, :default => "Logged in as")
|
27
|
-
= link_to current_admin.email,
|
27
|
+
= link_to current_admin.email, edit_admin_user_path(current_admin)
|
28
28
|
(#{link_to Radmin::I18n.t(:logout, :default => "Logout"), destroy_admin_session_path})
|
29
29
|
- else
|
30
30
|
.spacer40
|
@@ -3,9 +3,7 @@
|
|
3
3
|
= f.hidden_field :reset_password_token
|
4
4
|
= f.label :password, "New password"
|
5
5
|
= f.password_field :password
|
6
|
-
= f.error_message_on :password
|
7
6
|
= f.label :password_confirmation, "Confirm new password"
|
8
7
|
= f.password_field :password_confirmation
|
9
|
-
= f.error_message_on :password_confirmation
|
10
8
|
.buttons
|
11
9
|
= f.submit Radmin::I18n.t(:change_password, :default => "Change Password")
|
@@ -2,7 +2,6 @@
|
|
2
2
|
= form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :post }) do |f|
|
3
3
|
= f.label :email
|
4
4
|
= f.text_field :email
|
5
|
-
= f.error_message_on :email
|
6
5
|
.buttons
|
7
6
|
= f.submit Radmin::I18n.t(:send_instructions, :default => "Send Instructions")
|
8
7
|
= link_to t(:login, :default => "Login"), new_session_path(resource_name)
|
File without changes
|
File without changes
|
File without changes
|
@@ -1,6 +1,6 @@
|
|
1
1
|
- title Radmin::I18n.t(:settings,:default => "Application Settings")
|
2
2
|
%span.toolbar
|
3
|
-
= link_to(Radmin::I18n.t(:new_setting,:default => "New"), new_admin_setting_path) if
|
3
|
+
= link_to(Radmin::I18n.t(:new_setting,:default => "New"), new_admin_setting_path) if can? :create, Radmin::Setting
|
4
4
|
%p.intro= Radmin::I18n.t(:settings_list_intro,:default => "Application Settings")
|
5
5
|
%table
|
6
6
|
%thead
|
@@ -13,6 +13,7 @@
|
|
13
13
|
%td= link_to setting.key, edit_admin_setting_path(setting)
|
14
14
|
%td= setting.value
|
15
15
|
%td.last
|
16
|
-
= link_to(Radmin::I18n.t(:edit,:default => "Edit"), edit_admin_setting_path(setting), :class => "edit") if
|
17
|
-
|
18
|
-
|
16
|
+
= link_to(Radmin::I18n.t(:edit,:default => "Edit"), edit_admin_setting_path(setting), :class => "edit") if can? :update, Radmin::Setting
|
17
|
+
- if can? :destroy, Radmin::Setting
|
18
|
+
|
|
19
|
+
\#{link_to(Radmin::I18n.t(:delete,:default => "Delete"), admin_setting_path(setting), :confirm => Radmin::I18n.t(:are_you_sure,:default => "Are you sure?"), :method => :delete, :class => "delete")}
|
File without changes
|
@@ -15,7 +15,4 @@
|
|
15
15
|
%p.buttons
|
16
16
|
= form.submit Radmin::I18n.t(:save,:default=>"Save")
|
17
17
|
= Radmin::I18n.t(:or,:default=>"or")
|
18
|
-
|
19
|
-
= link_to Radmin::I18n.t(:cancel,:default=>"Cancel"), admin_users_path
|
20
|
-
- else
|
21
|
-
= link_to Radmin::I18n.t(:cancel,:default=>"Cancel"), admin_overview_path
|
18
|
+
= link_to Radmin::I18n.t(:cancel,:default=>"Cancel"), admin_users_path
|
File without changes
|
@@ -1,6 +1,6 @@
|
|
1
1
|
- title Radmin::I18n.t(:users,:default => "Users")
|
2
2
|
%span.toolbar
|
3
|
-
= link_to Radmin::I18n.t(:new_user,:default => "New"), new_admin_user_path if
|
3
|
+
= link_to Radmin::I18n.t(:new_user,:default => "New"), new_admin_user_path if can? :create, Radmin::User
|
4
4
|
%p.intro= Radmin::I18n.t(:users_list_intro,:default => "Users with access to admin panel.")
|
5
5
|
%table
|
6
6
|
%thead
|
@@ -13,6 +13,7 @@
|
|
13
13
|
%td= link_to h(user.email), edit_admin_user_path(user)
|
14
14
|
%td= user.roles.collect {|r| Radmin::I18n.t(r.name.underscore.to_sym,:default=>h(r.name.capitalize))}.join(",")
|
15
15
|
%td.last
|
16
|
-
= link_to Radmin::I18n.t(:edit,:default => "Edit"), edit_admin_user_path(user), :class => "edit" if
|
17
|
-
|
18
|
-
|
16
|
+
= link_to Radmin::I18n.t(:edit,:default => "Edit"), edit_admin_user_path(user), :class => "edit" if can? :update, Radmin::User, :id => user.id
|
17
|
+
- if can? :destroy, Radmin::User, :id => user.id
|
18
|
+
|
|
19
|
+
\#{link_to Radmin::I18n.t(:delete,:default => "Delete"), admin_user_path(user), :confirm => Radmin::I18n.t(:are_you_sure,:default => "Are you sure?"), :method => :delete, :class => "delete"}
|
File without changes
|
data/config/routes.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
Rails.application.routes.draw do
|
2
|
-
devise_for :admins, :class_name => 'Radmin::User', :path => 'admin', :path_names => { :sign_in => 'login', :sign_out => 'logout' }, :controllers => { :sessions => '
|
2
|
+
devise_for :admins, :class_name => 'Radmin::User', :path => 'admin', :path_names => { :sign_in => 'login', :sign_out => 'logout' }, :controllers => { :sessions => 'radmin/sessions', :passwords => 'radmin/passwords' }
|
3
3
|
|
4
|
-
match '/admin', :to => redirect('/admin/
|
5
|
-
namespace :admin do
|
6
|
-
resource
|
4
|
+
match '/admin', :to => redirect('/admin/dashboard'), :as => :admin
|
5
|
+
namespace :admin, :module => 'radmin' do
|
6
|
+
resource :dashboard, :only => [:show]
|
7
7
|
resources :settings, :except => [:show]
|
8
8
|
resources :users, :except => [:show]
|
9
9
|
end
|
data/lib/radmin.rb
CHANGED
data/lib/radmin/admin_ui.rb
CHANGED
@@ -75,23 +75,20 @@ module Radmin
|
|
75
75
|
end
|
76
76
|
|
77
77
|
def visible?(user)
|
78
|
-
|
78
|
+
params = Rails.application.routes.recognize_path(url, :method => :get)
|
79
|
+
if params && params[:controller]
|
80
|
+
resource = params[:controller].demodulize.sub("Controller", "").underscore.split('/').last.singularize
|
81
|
+
Radmin::Authorization.authorized?(user, params[:action], "Radmin::#{resource.capitalize}".constantize) rescue true
|
82
|
+
#ctx = params[:controller].sub('/','_').to_sym
|
83
|
+
#Authorization::Engine.instance.permit?(params[:action], :context => ctx, :user => user)
|
84
|
+
else
|
85
|
+
false
|
86
|
+
end
|
79
87
|
end
|
80
88
|
|
81
89
|
def relative_url
|
82
90
|
File.join('/', url)
|
83
91
|
end
|
84
|
-
|
85
|
-
private
|
86
|
-
def visible_by_controller?(user)
|
87
|
-
params = Rails.application.routes.recognize_path(url, :method => :get)
|
88
|
-
if params && params[:controller]
|
89
|
-
ctx = params[:controller].sub('/','_').to_sym
|
90
|
-
Authorization::Engine.instance.permit?(params[:action], :context => ctx, :user => user)
|
91
|
-
else
|
92
|
-
false
|
93
|
-
end
|
94
|
-
end
|
95
92
|
end
|
96
93
|
|
97
94
|
class << self
|
@@ -126,8 +123,11 @@ module Radmin
|
|
126
123
|
|
127
124
|
protected
|
128
125
|
def load_default_nav
|
126
|
+
general = nav_tab("General")
|
127
|
+
general << nav_item("Dashboard", "/admin/dashboard")
|
128
|
+
nav << general
|
129
|
+
|
129
130
|
settings = nav_tab("Settings")
|
130
|
-
settings << nav_item("Account", "/admin/account/edit")
|
131
131
|
settings << nav_item("Users", "/admin/users")
|
132
132
|
settings << nav_item("Application", "/admin/settings")
|
133
133
|
nav << settings
|
@@ -0,0 +1,47 @@
|
|
1
|
+
module Radmin
|
2
|
+
class Authorization
|
3
|
+
class DSLMethods
|
4
|
+
def role(role_name, &block)
|
5
|
+
#::Authorization.define_method method_name, &block
|
6
|
+
#role_name = role_name.to_sym
|
7
|
+
Radmin::Authorization.roles[role_name] ||= []
|
8
|
+
Radmin::Authorization.roles[role_name] << block
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
include CanCan::Ability
|
13
|
+
attr_accessor :user
|
14
|
+
cattr_accessor :roles
|
15
|
+
self.roles = {}
|
16
|
+
|
17
|
+
def initialize(user)
|
18
|
+
self.user = user
|
19
|
+
run_role(:guest) unless self.user.role_symbols.any?
|
20
|
+
self.user.role_symbols.each do |r|
|
21
|
+
run_role(r)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def includes(*role_names)
|
26
|
+
role_names.each do |role_name|
|
27
|
+
run_role(role_name.to_sym)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def self.authorized?(user, action, subject)
|
32
|
+
new(user).authorize!(action.to_sym, subject)
|
33
|
+
true
|
34
|
+
rescue CanCan::AccessDenied
|
35
|
+
false
|
36
|
+
end
|
37
|
+
|
38
|
+
def self.define_rules(file)
|
39
|
+
DSLMethods.new.instance_eval(File.read(file)) if File.exist?(file)
|
40
|
+
end
|
41
|
+
|
42
|
+
protected
|
43
|
+
def run_role(role_name)
|
44
|
+
self.class.roles[role_name].each { |block| instance_eval(&block) } if self.class.roles.include?(role_name)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
data/lib/radmin/engine.rb
CHANGED
@@ -1,8 +1,16 @@
|
|
1
|
-
require '
|
1
|
+
require 'cancan'
|
2
2
|
require 'devise'
|
3
3
|
require 'haml-rails'
|
4
4
|
|
5
5
|
module Radmin
|
6
|
-
class Engine < Rails::Engine
|
6
|
+
class Engine < Rails::Engine
|
7
|
+
initializer "radmin.add_authorization_rules" do |app|
|
8
|
+
Radmin::Authorization.define_rules(dsl_file)
|
9
|
+
end
|
10
|
+
|
11
|
+
protected
|
12
|
+
def dsl_file
|
13
|
+
File.expand_path("config/authorization.rb", File.dirname(File.dirname(File.dirname(__FILE__))))
|
14
|
+
end
|
7
15
|
end
|
8
16
|
end
|
data/lib/radmin/version.rb
CHANGED
data/radmin.gemspec
CHANGED
@@ -19,12 +19,12 @@ Gem::Specification.new do |s|
|
|
19
19
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
20
20
|
s.require_paths = ["lib"]
|
21
21
|
|
22
|
-
s.add_dependency "
|
22
|
+
s.add_dependency "cancan", "~> 1.6.5"
|
23
23
|
s.add_dependency "devise", "~> 1.3.4"
|
24
24
|
s.add_dependency "haml-rails", "~> 0.3.4"
|
25
25
|
|
26
|
-
s.add_development_dependency "rails", "3.0.7"
|
27
|
-
s.add_development_dependency "rake", "0.8.7"
|
26
|
+
s.add_development_dependency "rails", "~> 3.0.7"
|
27
|
+
s.add_development_dependency "rake", "~> 0.8.7"
|
28
28
|
s.add_development_dependency "capybara", "~> 0.4.0"
|
29
29
|
s.add_development_dependency "rspec-rails", "~> 2.0.0.beta"
|
30
30
|
s.add_development_dependency "launchy", "~> 0.4.0"
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# Additional translations at http://github.com/plataformatec/devise/wiki/I18n
|
2
|
+
|
3
|
+
en:
|
4
|
+
errors:
|
5
|
+
messages:
|
6
|
+
expired: "has expired, please request a new one"
|
7
|
+
not_found: "not found"
|
8
|
+
already_confirmed: "was already confirmed, please try signing in"
|
9
|
+
not_locked: "was not locked"
|
10
|
+
not_saved:
|
11
|
+
one: "1 error prohibited this %{resource} from being saved:"
|
12
|
+
other: "%{count} errors prohibited this %{resource} from being saved:"
|
13
|
+
|
14
|
+
devise:
|
15
|
+
failure:
|
16
|
+
already_authenticated: 'You are already signed in.'
|
17
|
+
unauthenticated: 'You need to sign in or sign up before continuing.'
|
18
|
+
unconfirmed: 'You have to confirm your account before continuing.'
|
19
|
+
locked: 'Your account is locked.'
|
20
|
+
invalid: 'Invalid email or password.'
|
21
|
+
invalid_token: 'Invalid authentication token.'
|
22
|
+
timeout: 'Your session expired, please sign in again to continue.'
|
23
|
+
inactive: 'Your account was not activated yet.'
|
24
|
+
sessions:
|
25
|
+
signed_in: 'Signed in successfully.'
|
26
|
+
signed_out: 'Signed out successfully.'
|
27
|
+
passwords:
|
28
|
+
send_instructions: 'You will receive an email with instructions about how to reset your password in a few minutes.'
|
29
|
+
updated: 'Your password was changed successfully. You are now signed in.'
|
30
|
+
confirmations:
|
31
|
+
send_instructions: 'You will receive an email with instructions about how to confirm your account in a few minutes.'
|
32
|
+
confirmed: 'Your account was successfully confirmed. You are now signed in.'
|
33
|
+
registrations:
|
34
|
+
signed_up: 'Welcome! You have signed up successfully.'
|
35
|
+
inactive_signed_up: 'You have signed up successfully. However, we could not sign you in because your account is %{reason}.'
|
36
|
+
updated: 'You updated your account successfully.'
|
37
|
+
destroyed: 'Bye! Your account was successfully cancelled. We hope to see you again soon.'
|
38
|
+
unlocks:
|
39
|
+
send_instructions: 'You will receive an email with instructions about how to unlock your account in a few minutes.'
|
40
|
+
unlocked: 'Your account was successfully unlocked. You are now signed in.'
|
41
|
+
omniauth_callbacks:
|
42
|
+
success: 'Successfully authorized from %{kind} account.'
|
43
|
+
failure: 'Could not authorize you from %{kind} because "%{reason}".'
|
44
|
+
mailer:
|
45
|
+
confirmation_instructions:
|
46
|
+
subject: 'Confirmation instructions'
|
47
|
+
reset_password_instructions:
|
48
|
+
subject: 'Reset password instructions'
|
49
|
+
unlock_instructions:
|
50
|
+
subject: 'Unlock Instructions'
|
metadata
CHANGED
@@ -1,157 +1,155 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: radmin
|
3
|
-
version: !ruby/object:Gem::Version
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.3.1
|
4
5
|
prerelease:
|
5
|
-
version: 0.2.0
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
7
|
+
authors:
|
8
8
|
- Damian Caruso
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
name: declarative_authorization
|
18
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
12
|
+
date: 2011-07-30 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: cancan
|
16
|
+
requirement: &17660220 !ruby/object:Gem::Requirement
|
19
17
|
none: false
|
20
|
-
requirements:
|
18
|
+
requirements:
|
21
19
|
- - ~>
|
22
|
-
- !ruby/object:Gem::Version
|
23
|
-
version:
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 1.6.5
|
24
22
|
type: :runtime
|
25
23
|
prerelease: false
|
26
|
-
version_requirements: *
|
27
|
-
- !ruby/object:Gem::Dependency
|
24
|
+
version_requirements: *17660220
|
25
|
+
- !ruby/object:Gem::Dependency
|
28
26
|
name: devise
|
29
|
-
requirement: &
|
27
|
+
requirement: &17659260 !ruby/object:Gem::Requirement
|
30
28
|
none: false
|
31
|
-
requirements:
|
29
|
+
requirements:
|
32
30
|
- - ~>
|
33
|
-
- !ruby/object:Gem::Version
|
31
|
+
- !ruby/object:Gem::Version
|
34
32
|
version: 1.3.4
|
35
33
|
type: :runtime
|
36
34
|
prerelease: false
|
37
|
-
version_requirements: *
|
38
|
-
- !ruby/object:Gem::Dependency
|
35
|
+
version_requirements: *17659260
|
36
|
+
- !ruby/object:Gem::Dependency
|
39
37
|
name: haml-rails
|
40
|
-
requirement: &
|
38
|
+
requirement: &17658180 !ruby/object:Gem::Requirement
|
41
39
|
none: false
|
42
|
-
requirements:
|
40
|
+
requirements:
|
43
41
|
- - ~>
|
44
|
-
- !ruby/object:Gem::Version
|
42
|
+
- !ruby/object:Gem::Version
|
45
43
|
version: 0.3.4
|
46
44
|
type: :runtime
|
47
45
|
prerelease: false
|
48
|
-
version_requirements: *
|
49
|
-
- !ruby/object:Gem::Dependency
|
46
|
+
version_requirements: *17658180
|
47
|
+
- !ruby/object:Gem::Dependency
|
50
48
|
name: rails
|
51
|
-
requirement: &
|
49
|
+
requirement: &17657440 !ruby/object:Gem::Requirement
|
52
50
|
none: false
|
53
|
-
requirements:
|
54
|
-
- -
|
55
|
-
- !ruby/object:Gem::Version
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
56
54
|
version: 3.0.7
|
57
55
|
type: :development
|
58
56
|
prerelease: false
|
59
|
-
version_requirements: *
|
60
|
-
- !ruby/object:Gem::Dependency
|
57
|
+
version_requirements: *17657440
|
58
|
+
- !ruby/object:Gem::Dependency
|
61
59
|
name: rake
|
62
|
-
requirement: &
|
60
|
+
requirement: &17656460 !ruby/object:Gem::Requirement
|
63
61
|
none: false
|
64
|
-
requirements:
|
65
|
-
- -
|
66
|
-
- !ruby/object:Gem::Version
|
62
|
+
requirements:
|
63
|
+
- - ~>
|
64
|
+
- !ruby/object:Gem::Version
|
67
65
|
version: 0.8.7
|
68
66
|
type: :development
|
69
67
|
prerelease: false
|
70
|
-
version_requirements: *
|
71
|
-
- !ruby/object:Gem::Dependency
|
68
|
+
version_requirements: *17656460
|
69
|
+
- !ruby/object:Gem::Dependency
|
72
70
|
name: capybara
|
73
|
-
requirement: &
|
71
|
+
requirement: &17655560 !ruby/object:Gem::Requirement
|
74
72
|
none: false
|
75
|
-
requirements:
|
73
|
+
requirements:
|
76
74
|
- - ~>
|
77
|
-
- !ruby/object:Gem::Version
|
75
|
+
- !ruby/object:Gem::Version
|
78
76
|
version: 0.4.0
|
79
77
|
type: :development
|
80
78
|
prerelease: false
|
81
|
-
version_requirements: *
|
82
|
-
- !ruby/object:Gem::Dependency
|
79
|
+
version_requirements: *17655560
|
80
|
+
- !ruby/object:Gem::Dependency
|
83
81
|
name: rspec-rails
|
84
|
-
requirement: &
|
82
|
+
requirement: &17654760 !ruby/object:Gem::Requirement
|
85
83
|
none: false
|
86
|
-
requirements:
|
84
|
+
requirements:
|
87
85
|
- - ~>
|
88
|
-
- !ruby/object:Gem::Version
|
86
|
+
- !ruby/object:Gem::Version
|
89
87
|
version: 2.0.0.beta
|
90
88
|
type: :development
|
91
89
|
prerelease: false
|
92
|
-
version_requirements: *
|
93
|
-
- !ruby/object:Gem::Dependency
|
90
|
+
version_requirements: *17654760
|
91
|
+
- !ruby/object:Gem::Dependency
|
94
92
|
name: launchy
|
95
|
-
requirement: &
|
93
|
+
requirement: &17651240 !ruby/object:Gem::Requirement
|
96
94
|
none: false
|
97
|
-
requirements:
|
95
|
+
requirements:
|
98
96
|
- - ~>
|
99
|
-
- !ruby/object:Gem::Version
|
97
|
+
- !ruby/object:Gem::Version
|
100
98
|
version: 0.4.0
|
101
99
|
type: :development
|
102
100
|
prerelease: false
|
103
|
-
version_requirements: *
|
104
|
-
- !ruby/object:Gem::Dependency
|
101
|
+
version_requirements: *17651240
|
102
|
+
- !ruby/object:Gem::Dependency
|
105
103
|
name: sqlite3
|
106
|
-
requirement: &
|
104
|
+
requirement: &17650480 !ruby/object:Gem::Requirement
|
107
105
|
none: false
|
108
|
-
requirements:
|
109
|
-
- -
|
110
|
-
- !ruby/object:Gem::Version
|
111
|
-
version:
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
112
110
|
type: :development
|
113
111
|
prerelease: false
|
114
|
-
version_requirements: *
|
112
|
+
version_requirements: *17650480
|
115
113
|
description: A drop in admin panel for existing rails applications
|
116
|
-
email:
|
114
|
+
email:
|
117
115
|
- damian.caruso@gmail.com
|
118
116
|
executables: []
|
119
|
-
|
120
117
|
extensions: []
|
121
|
-
|
122
118
|
extra_rdoc_files: []
|
123
|
-
|
124
|
-
files:
|
119
|
+
files:
|
125
120
|
- .gitignore
|
126
121
|
- .rspec
|
122
|
+
- .rvmrc
|
127
123
|
- Gemfile
|
128
124
|
- MIT-LICENSE
|
129
125
|
- README
|
130
126
|
- Rakefile
|
131
|
-
- app/controllers/
|
132
|
-
- app/controllers/
|
133
|
-
- app/controllers/
|
134
|
-
- app/controllers/
|
135
|
-
- app/controllers/
|
136
|
-
- app/controllers/
|
137
|
-
- app/helpers/
|
127
|
+
- app/controllers/radmin/dashboards_controller.rb
|
128
|
+
- app/controllers/radmin/passwords_controller.rb
|
129
|
+
- app/controllers/radmin/sessions_controller.rb
|
130
|
+
- app/controllers/radmin/settings_controller.rb
|
131
|
+
- app/controllers/radmin/users_controller.rb
|
132
|
+
- app/controllers/radmin_controller.rb
|
133
|
+
- app/helpers/radmin_helper.rb
|
138
134
|
- app/models/radmin/assignment.rb
|
139
135
|
- app/models/radmin/role.rb
|
140
136
|
- app/models/radmin/setting.rb
|
141
137
|
- app/models/radmin/user.rb
|
142
|
-
- app/views/
|
143
|
-
- app/views/
|
144
|
-
- app/views/
|
145
|
-
- app/views/
|
146
|
-
- app/views/
|
147
|
-
- app/views/
|
148
|
-
- app/views/
|
149
|
-
- app/views/
|
150
|
-
- app/views/
|
151
|
-
- app/views/
|
152
|
-
- app/views/
|
153
|
-
- app/views/
|
154
|
-
- app/views/
|
138
|
+
- app/views/layouts/radmin.html.haml
|
139
|
+
- app/views/radmin/dashboards/_dashboard.html.haml
|
140
|
+
- app/views/radmin/dashboards/show.html.haml
|
141
|
+
- app/views/radmin/passwords/edit.html.haml
|
142
|
+
- app/views/radmin/passwords/new.html.haml
|
143
|
+
- app/views/radmin/sessions/new.html.haml
|
144
|
+
- app/views/radmin/settings/_form.html.haml
|
145
|
+
- app/views/radmin/settings/edit.html.haml
|
146
|
+
- app/views/radmin/settings/index.html.haml
|
147
|
+
- app/views/radmin/settings/new.html.haml
|
148
|
+
- app/views/radmin/users/_form.html.haml
|
149
|
+
- app/views/radmin/users/edit.html.haml
|
150
|
+
- app/views/radmin/users/index.html.haml
|
151
|
+
- app/views/radmin/users/new.html.haml
|
152
|
+
- config/authorization.rb
|
155
153
|
- config/routes.rb
|
156
154
|
- lib/generators/radmin/install_generator.rb
|
157
155
|
- lib/generators/radmin/templates/assets/images/admin/topnav_active.gif
|
@@ -161,13 +159,13 @@ files:
|
|
161
159
|
- lib/generators/radmin/templates/assets/javascripts/admin/jquery.rails.js
|
162
160
|
- lib/generators/radmin/templates/assets/stylesheets/admin/reset.css
|
163
161
|
- lib/generators/radmin/templates/assets/stylesheets/admin/style.css
|
164
|
-
- lib/generators/radmin/templates/authorization_rules.rb
|
165
162
|
- lib/generators/radmin/templates/migrations/01_radmin_create_users.rb
|
166
163
|
- lib/generators/radmin/templates/migrations/02_radmin_create_roles.rb
|
167
164
|
- lib/generators/radmin/templates/migrations/03_radmin_create_assignments.rb
|
168
165
|
- lib/generators/radmin/templates/migrations/04_radmin_create_settings.rb
|
169
166
|
- lib/radmin.rb
|
170
167
|
- lib/radmin/admin_ui.rb
|
168
|
+
- lib/radmin/authorization.rb
|
171
169
|
- lib/radmin/engine.rb
|
172
170
|
- lib/radmin/i18n.rb
|
173
171
|
- lib/radmin/version.rb
|
@@ -179,7 +177,6 @@ files:
|
|
179
177
|
- spec/dummy/app/views/layouts/application.html.erb
|
180
178
|
- spec/dummy/config.ru
|
181
179
|
- spec/dummy/config/application.rb
|
182
|
-
- spec/dummy/config/authorization_rules.rb
|
183
180
|
- spec/dummy/config/boot.rb
|
184
181
|
- spec/dummy/config/database.yml
|
185
182
|
- spec/dummy/config/environment.rb
|
@@ -192,6 +189,7 @@ files:
|
|
192
189
|
- spec/dummy/config/initializers/mime_types.rb
|
193
190
|
- spec/dummy/config/initializers/secret_token.rb
|
194
191
|
- spec/dummy/config/initializers/session_store.rb
|
192
|
+
- spec/dummy/config/locales/devise.en.yml
|
195
193
|
- spec/dummy/config/locales/en.yml
|
196
194
|
- spec/dummy/config/routes.rb
|
197
195
|
- spec/dummy/db/migrate/20110524171909_radmin_create_users.rb
|
@@ -232,39 +230,34 @@ files:
|
|
232
230
|
- spec/integration/navigation_spec.rb
|
233
231
|
- spec/radmin_spec.rb
|
234
232
|
- spec/spec_helper.rb
|
235
|
-
has_rdoc: true
|
236
233
|
homepage: http://github.com/cdamian/radmin
|
237
234
|
licenses: []
|
238
|
-
|
239
235
|
post_install_message:
|
240
236
|
rdoc_options: []
|
241
|
-
|
242
|
-
require_paths:
|
237
|
+
require_paths:
|
243
238
|
- lib
|
244
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
239
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
245
240
|
none: false
|
246
|
-
requirements:
|
247
|
-
- -
|
248
|
-
- !ruby/object:Gem::Version
|
249
|
-
|
250
|
-
segments:
|
241
|
+
requirements:
|
242
|
+
- - ! '>='
|
243
|
+
- !ruby/object:Gem::Version
|
244
|
+
version: '0'
|
245
|
+
segments:
|
251
246
|
- 0
|
252
|
-
|
253
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
247
|
+
hash: 1266151900004332354
|
248
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
254
249
|
none: false
|
255
|
-
requirements:
|
256
|
-
- -
|
257
|
-
- !ruby/object:Gem::Version
|
258
|
-
|
259
|
-
segments:
|
250
|
+
requirements:
|
251
|
+
- - ! '>='
|
252
|
+
- !ruby/object:Gem::Version
|
253
|
+
version: '0'
|
254
|
+
segments:
|
260
255
|
- 0
|
261
|
-
|
256
|
+
hash: 1266151900004332354
|
262
257
|
requirements: []
|
263
|
-
|
264
258
|
rubyforge_project: radmin
|
265
|
-
rubygems_version: 1.6
|
259
|
+
rubygems_version: 1.8.6
|
266
260
|
signing_key:
|
267
261
|
specification_version: 3
|
268
262
|
summary: A drop in admin panel for existing rails applications
|
269
263
|
test_files: []
|
270
|
-
|
@@ -1,16 +0,0 @@
|
|
1
|
-
class Admin::AccountsController < AdminController
|
2
|
-
def edit
|
3
|
-
@user = current_admin
|
4
|
-
end
|
5
|
-
|
6
|
-
def update
|
7
|
-
@user = current_admin
|
8
|
-
if @user.update_attributes(params[:user])
|
9
|
-
flash[:notice] = Radmin::I18n.t(:account_updated, :default => "Account updated.")
|
10
|
-
redirect_to edit_admin_account_url
|
11
|
-
else
|
12
|
-
flash.now[:alert] = Radmin::I18n.t(:account_could_not_be_updated, :default => "Account could not be updated.")
|
13
|
-
render :action => :edit
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
class AdminController < ApplicationController
|
2
|
-
helper :admin
|
3
|
-
before_filter :authenticate_admin!
|
4
|
-
layout "admin"
|
5
|
-
|
6
|
-
protected
|
7
|
-
def current_user
|
8
|
-
current_admin
|
9
|
-
end
|
10
|
-
|
11
|
-
def permission_denied
|
12
|
-
flash[:alert] = Radmin::I18n.t(:permission_denied,:default => "Sorry, you are not allowed to access that page.")
|
13
|
-
redirect_to admin_url
|
14
|
-
end
|
15
|
-
end
|
@@ -1,11 +0,0 @@
|
|
1
|
-
- title Radmin::I18n.t(:edit_user,:default => "Edit Account")
|
2
|
-
= form_for @user, :as => :user, :url => admin_account_path do |f|
|
3
|
-
.col
|
4
|
-
= f.label :email, Radmin::User.human_attribute_name("email")
|
5
|
-
= f.text_field :email
|
6
|
-
= f.label :password, Radmin::I18n.t(:new_password, :default => "New Password")
|
7
|
-
= f.password_field :password
|
8
|
-
= f.label :password_confirmation, Radmin::User.human_attribute_name("password_confirmation")
|
9
|
-
= f.password_field :password_confirmation
|
10
|
-
%p.buttons
|
11
|
-
= f.submit Radmin::I18n.t(:save,:default=>"Save")
|
@@ -1,17 +0,0 @@
|
|
1
|
-
authorization do
|
2
|
-
role :guest do
|
3
|
-
has_permission_on :admin_accounts, :to => [:show,:edit,:update]
|
4
|
-
end
|
5
|
-
|
6
|
-
role :admin do
|
7
|
-
includes :guest
|
8
|
-
has_permission_on :admin_users, :to => :manage
|
9
|
-
has_permission_on :admin_settings, :to => :manage
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
privileges do
|
14
|
-
privilege :manage do
|
15
|
-
includes :index,:new,:create,:edit,:update,:show,:destroy
|
16
|
-
end
|
17
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
authorization do
|
2
|
-
role :guest do
|
3
|
-
has_permission_on :admin_accounts, :to => [:show,:edit,:update]
|
4
|
-
end
|
5
|
-
|
6
|
-
role :admin do
|
7
|
-
includes :guest
|
8
|
-
has_permission_on :admin_users, :to => :manage
|
9
|
-
has_permission_on :admin_settings, :to => :manage
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
privileges do
|
14
|
-
privilege :manage do
|
15
|
-
includes :index,:new,:create,:edit,:update,:show,:destroy
|
16
|
-
end
|
17
|
-
end
|