adminsite 3.0.0 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -4
- data/app/controllers/adminsite/admin/resources_controller.rb +4 -0
- data/app/controllers/adminsite/admin_application_controller.rb +2 -2
- data/app/controllers/adminsite/admin_user_sessions_controller.rb +5 -0
- data/app/helpers/admin/adminsite_application_helper.rb +20 -5
- data/app/models/adminsite/ability.rb +6 -5
- data/app/views/adminsite/admin/shared/_admin_menu.html.haml +1 -1
- data/lib/adminsite/version.rb +1 -1
- metadata +2 -3
- data/adminsite.gemspec +0 -50
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a77aace1878bec05464bc819f93f016b2cb264b9
|
4
|
+
data.tar.gz: 9e2923bfc266f94420be21a62b2156fa00839d59
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a3816534c56c82ef0af32a78355dec3a651ea556b6d4ec4610c247886962b47e45b96d37e5ffa007f0c0a6247a4487e76769d79814493f5f6fb9ae6ee26fa386
|
7
|
+
data.tar.gz: bde740774f9938548bfb0923736e864a18935503a7a2ba601f118f5395d85e3dfcd6f42b8b8208962d4242bbbeae02cacae0be172b723249e92c14bcaeb12978
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
adminsite (3.
|
4
|
+
adminsite (3.1.0)
|
5
5
|
actionpack-page_caching
|
6
6
|
cancancan (~> 1.10)
|
7
7
|
codemirror-rails (>= 4.8)
|
@@ -213,6 +213,3 @@ DEPENDENCIES
|
|
213
213
|
rspec
|
214
214
|
shoulda
|
215
215
|
simplecov (>= 0.10.0)
|
216
|
-
|
217
|
-
BUNDLED WITH
|
218
|
-
1.10.6
|
@@ -63,6 +63,10 @@ class Adminsite::Admin::ResourcesController < Adminsite::Admin::CrudController
|
|
63
63
|
self.class.resource_class
|
64
64
|
end
|
65
65
|
|
66
|
+
def authorize_resource_class
|
67
|
+
resource_class
|
68
|
+
end
|
69
|
+
|
66
70
|
def resource_class_underscore
|
67
71
|
@resource_class_underscore ||= resource_class.to_s.underscore.gsub('/','_')
|
68
72
|
end
|
@@ -8,7 +8,7 @@ class Adminsite::AdminApplicationController < ActionController::Base
|
|
8
8
|
before_filter :authenticate_adminsite_admin_user!
|
9
9
|
|
10
10
|
include ::CanCan::ControllerAdditions
|
11
|
-
authorize_resource class: lambda { |context| context.
|
11
|
+
authorize_resource class: lambda { |context| context.authorize_resource_class }
|
12
12
|
# check_authorization
|
13
13
|
|
14
14
|
rescue_from CanCan::AccessDenied do |exception|
|
@@ -21,7 +21,7 @@ class Adminsite::AdminApplicationController < ActionController::Base
|
|
21
21
|
super(action, subject, *args)
|
22
22
|
end
|
23
23
|
|
24
|
-
def
|
24
|
+
def authorize_resource_class
|
25
25
|
self
|
26
26
|
end
|
27
27
|
|
@@ -85,15 +85,30 @@ module Admin::AdminsiteApplicationHelper
|
|
85
85
|
end
|
86
86
|
|
87
87
|
def menu_item(label, url, child_controller_names = [], klasses = nil, method = nil, admin_menu = label)
|
88
|
-
|
89
|
-
|
88
|
+
result = ''
|
89
|
+
child_menus = []
|
90
|
+
|
91
|
+
child_controller_names_authorized = child_controller_names.select do |child_controller_name|
|
92
|
+
controller_class_name = "#{child_controller_name}_controller".classify
|
93
|
+
controller_class = eval("defined?(Adminsite::" + "#{controller_class_name}) ? Adminsite::#{controller_class_name} : Adminsite::Admin::#{controller_class_name}".classify)
|
94
|
+
can?(:read, controller_class.new.authorize_resource_class)
|
95
|
+
end
|
90
96
|
|
91
97
|
if current_url?(url, label) || ( child_controller_active?(child_controller_names) && current_admin_menu == admin_menu)
|
92
|
-
|
93
|
-
|
94
|
-
content_for(:content_menu, child_menu)
|
98
|
+
child_controller_names_authorized.each do |child_controller_name|
|
99
|
+
child_menus << content_menu_item(child_controller_name, admin_menu, nil, nil )
|
95
100
|
end
|
96
101
|
end
|
102
|
+
child_menus = child_menus.compact
|
103
|
+
|
104
|
+
if child_controller_names_authorized.count > 0
|
105
|
+
html_options = {method: method}
|
106
|
+
html_options[:title] = current_adminsite_admin_user.email if klasses == 'log_out'
|
107
|
+
link = link_to(label, "#{url}?admin_menu=#{admin_menu}", html_options)
|
108
|
+
result = raw "<li class='#{html_classes(url, nil, klasses, admin_menu, label )}'>#{link}</li>"
|
109
|
+
|
110
|
+
content_for(:content_menu, child_menus.join("\n").html_safe )
|
111
|
+
end
|
97
112
|
result
|
98
113
|
end
|
99
114
|
|
@@ -9,16 +9,17 @@ module Adminsite
|
|
9
9
|
when :admin
|
10
10
|
can :manage, :all
|
11
11
|
when :editor
|
12
|
-
can :read,
|
13
|
-
can :read,
|
14
|
-
can :read,
|
15
|
-
can :read,
|
16
|
-
can :read,
|
12
|
+
can :read, Adminsite::Page
|
13
|
+
can :read, Adminsite::PageLayout
|
14
|
+
can :read, Adminsite::FileAsset
|
15
|
+
can :read, Adminsite::AdminUser
|
16
|
+
can :read, Adminsite::AdminUserRole
|
17
17
|
when :customer
|
18
18
|
# can :read, Adminsite::Page
|
19
19
|
# can :read, Adminsite::PageLayout
|
20
20
|
# can :read, Adminsite::FileAsset
|
21
21
|
end
|
22
|
+
can :manage, Adminsite::AdminUserSessionsController
|
22
23
|
end
|
23
24
|
end
|
24
25
|
end
|
data/lib/adminsite/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: adminsite
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robin Wunderlin
|
@@ -247,7 +247,6 @@ files:
|
|
247
247
|
- README.markdown
|
248
248
|
- Rakefile
|
249
249
|
- USAGE
|
250
|
-
- adminsite.gemspec
|
251
250
|
- app/admin_configs/adminsite/adminsite_admin_user_admin_config.rb
|
252
251
|
- app/admin_configs/adminsite/adminsite_admin_user_role_admin_config.rb
|
253
252
|
- app/admin_configs/adminsite/adminsite_file_asset_admin_config.rb
|
@@ -396,7 +395,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
396
395
|
version: '0'
|
397
396
|
requirements: []
|
398
397
|
rubyforge_project:
|
399
|
-
rubygems_version: 2.
|
398
|
+
rubygems_version: 2.2.2
|
400
399
|
signing_key:
|
401
400
|
specification_version: 4
|
402
401
|
summary: Basic Admin Backend interface for Ruby on Rails
|
data/adminsite.gemspec
DELETED
@@ -1,50 +0,0 @@
|
|
1
|
-
$:.push File.expand_path("../lib", __FILE__)
|
2
|
-
|
3
|
-
# Maintain your gem's version:
|
4
|
-
require "adminsite/version"
|
5
|
-
|
6
|
-
Gem::Specification.new do |s|
|
7
|
-
s.name = "adminsite"
|
8
|
-
s.version = Adminsite::VERSION
|
9
|
-
s.authors = ["Robin Wunderlin"]
|
10
|
-
s.email = "robin@wunderlin.dk"
|
11
|
-
s.homepage = "http://www.rhg.dk"
|
12
|
-
s.summary = "Basic Admin Backend interface for Ruby on Rails"
|
13
|
-
s.description = "Basic Admin Backend interface for Ruby on Rails"
|
14
|
-
|
15
|
-
s.files = Dir["[A-Z]*", "{app,config,db,public,lib,generators}/**/*"]+ ["LICENSE", "Rakefile", "README.markdown"]
|
16
|
-
s.extra_rdoc_files = [
|
17
|
-
"README.markdown"
|
18
|
-
]
|
19
|
-
|
20
|
-
s.required_ruby_version = '>= 2.0.0'
|
21
|
-
s.require_paths = ["lib"]
|
22
|
-
|
23
|
-
# s.date = "#{Time.now.to_date}"
|
24
|
-
s.post_install_message = File.open('USAGE').read
|
25
|
-
|
26
|
-
s.add_runtime_dependency(%q<rails>, [">= 4.1"])
|
27
|
-
s.add_runtime_dependency(%q<actionpack-page_caching>, [">= 0"])
|
28
|
-
s.add_runtime_dependency(%q<jquery-rails>, [">= 0"])
|
29
|
-
|
30
|
-
s.add_runtime_dependency(%q<domainatrix>, [">= 0"])
|
31
|
-
|
32
|
-
s.add_runtime_dependency(%q<devise>, ["~> 3.4"])
|
33
|
-
s.add_runtime_dependency(%q<cancancan>, ["~> 1.10"])
|
34
|
-
s.add_runtime_dependency(%q<kaminari>, [">= 0.15.0"])
|
35
|
-
s.add_runtime_dependency(%q<ransack>, [">= 1.3"])
|
36
|
-
|
37
|
-
s.add_runtime_dependency(%q<haml>, [">= 0"])
|
38
|
-
s.add_runtime_dependency(%q<formtastic>, [">= 3.1.3"])
|
39
|
-
|
40
|
-
s.add_runtime_dependency(%q<sass-rails>, [">= 0"])
|
41
|
-
|
42
|
-
s.add_dependency "codemirror-rails", '>= 4.8'
|
43
|
-
s.add_runtime_dependency(%q<liquid>, [">= 0"])
|
44
|
-
|
45
|
-
s.add_runtime_dependency(%q<paperclip>, [">= 0"])
|
46
|
-
|
47
|
-
s.add_development_dependency("bundler", ">= 1.5")
|
48
|
-
s.add_development_dependency("rake")
|
49
|
-
end
|
50
|
-
|