unidom-authorization 1.4 → 1.4.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4cf0961f1843a8b6345fb9d4c2e47d272cdff6b5
4
- data.tar.gz: 88a981b09287bd6344624c95d6f62db57fb1862e
3
+ metadata.gz: 654d554329c90d5599310a44afce0a733e7484d8
4
+ data.tar.gz: b074df31f048ecb5bfcb2bfcdacdeacda03b74d7
5
5
  SHA512:
6
- metadata.gz: 7eba7c80d048bcfdac0ae9e47af0d6bbdfaf92e77f3e0b071f99346dac1400f85a230e15d8bc44becc2d63e7c7f07eee6c9577d813e0d4818bd5965de416629e
7
- data.tar.gz: 17137ef55a188f21da4ba28348b0b4ce1f292208f21a18699d3cbc87fa4bafece7905163ec87da4f81b4ffa80ea850fc8db4381f3ba938d9d353ef9a6dd9d396
6
+ metadata.gz: c8f4ec4562ca51ca001c30fb5efda0c05990402ac86cfeee632dd5cff274c2652c04840e561020a49b925d6b1c50f21ef6956e557514cbd841e9771f648484d9
7
+ data.tar.gz: bf93c57e7671c032f39e1892b977f230dfe1fc51c92cf5ce224e93c5bdd537c86e43339ff310274b3f08cbcdff2d821e2bb5759c21c22905219b1f000991aff0
data/README.md CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  [![License](https://img.shields.io/badge/license-MIT-green.svg)](http://opensource.org/licenses/MIT)
4
4
  [![Gem Version](https://badge.fury.io/rb/unidom-authorization.svg)](https://badge.fury.io/rb/unidom-authorization)
5
+ [![Dependency Status](https://gemnasium.com/badges/github.com/topbitdu/unidom-authorization.svg)](https://gemnasium.com/github.com/topbitdu/unidom-authorization)
5
6
 
6
7
  Unidom (UNIfied Domain Object Model) is a series of domain model engines. The Authorization domain model engine includes the Permission and Authorizing models.
7
8
  Unidom (统一领域对象模型)是一系列的领域模型引擎。授权领域模型引擎包括权限、授权的模型。
@@ -9,12 +10,14 @@ Unidom (统一领域对象模型)是一系列的领域模型引擎。授权领
9
10
 
10
11
 
11
12
  ## Recent Update
13
+
12
14
  Check out the [Road Map](ROADMAP.md) to find out what's the next.
13
15
  Check out the [Change Log](CHANGELOG.md) to find out what's new.
14
16
 
15
17
 
16
18
 
17
19
  ## Usage in Gemfile
20
+
18
21
  ```ruby
19
22
  gem 'unidom-authorization'
20
23
  ```
@@ -22,6 +25,7 @@ gem 'unidom-authorization'
22
25
 
23
26
 
24
27
  ## Run the Database Migration
28
+
25
29
  ```shell
26
30
  rake db:migrate
27
31
  ```
@@ -30,6 +34,7 @@ The migration versions start with 200004.
30
34
 
31
35
 
32
36
  ## Call the Model
37
+
33
38
  ```ruby
34
39
  Unidom::Authorization::Permission.valid_at.alive
35
40
  Unidom::Authorization::Authorizing.valid_at.alive
@@ -49,12 +54,14 @@ user.is_authorized? permission: permission, at: Time.now # true
49
54
 
50
55
 
51
56
  ## Include the Concerns
57
+
52
58
  ```ruby
53
59
  include Unidom::Authorization::Concerns::AsAuthorized
54
60
  include Unidom::Authorization::Concerns::AsPermission
55
61
  ```
56
62
 
57
63
  ### As Authorized concern
64
+
58
65
  The As Authorized concern do the following tasks for the includer automatically:
59
66
  1. Define the has_many :authorizings macro as: ``has_many :authorizings, class_name: 'Unidom::Authorization::Authorizing', as: :authorized``
60
67
  2. Define the has_many :permissions macro as: ``has_many :permissions, through: :authorizings, source: :permission``
@@ -62,7 +69,8 @@ The As Authorized concern do the following tasks for the includer automatically:
62
69
  4. Define the #is_authorized? method as: ``is_authorized?(permission: nil, at: Time.now)``
63
70
 
64
71
  ### As Permission concern
72
+
65
73
  The As Permission concern do the following tasks for the includer automatically:
66
74
  1. Define the has_many :authorizings macro as: ``has_many :authorizings, class_name: 'Unidom::Authorization::Authorizing'``
67
75
  2. Define the #authorize! method as: ``authorize!(authorized, by: nil, at: Time.now)``
68
- 3. Define the #authorize? method as: ``authorize?(authorized, at: Time.now)``
76
+ 3. Define the #authorize? method as: ``authorize?(authorized, at: Time.now)``
data/Rakefile CHANGED
@@ -10,7 +10,7 @@ RDoc::Task.new(:rdoc) do |rdoc|
10
10
  rdoc.rdoc_dir = 'rdoc'
11
11
  rdoc.title = 'Unidom Authorization'
12
12
  rdoc.options << '--line-numbers'
13
- rdoc.rdoc_files.include('README.rdoc')
13
+ rdoc.rdoc_files.include('README.md')
14
14
  rdoc.rdoc_files.include('lib/**/*.rb')
15
15
  end
16
16
 
@@ -20,5 +20,5 @@ load 'rails/tasks/statistics.rake'
20
20
 
21
21
 
22
22
 
23
- Bundler::GemHelper.install_tasks
23
+ require 'bundler/gem_tasks'
24
24
 
@@ -0,0 +1,2 @@
1
+ //= link_directory ../javascripts/unidom/authorization .js
2
+ //= link_directory ../stylesheets/unidom/authorization .css
@@ -5,7 +5,7 @@
5
5
  // or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
6
6
  //
7
7
  // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
- // compiled file.
8
+ // compiled file. JavaScript code in this file should be added after the last require_* statement.
9
9
  //
10
10
  // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
11
11
  // about supported directives.
@@ -6,9 +6,9 @@
6
6
  * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
7
7
  *
8
8
  * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9
- * compiled file so the styles you add here take precedence over styles defined in any styles
10
- * defined in the other CSS/SCSS files in this directory. It is generally better to create a new
11
- * file per style scope.
9
+ * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
10
+ * files in this directory. Styles in this file should be added after the last require_* statement.
11
+ * It is generally better to create a new file per style scope.
12
12
  *
13
13
  *= require_self
14
14
  */
@@ -1,2 +1,3 @@
1
1
  class Unidom::Authorization::ApplicationController < ActionController::Base
2
+ protect_from_forgery with: :exception
2
3
  end
@@ -0,0 +1,2 @@
1
+ class Unidom::Authorization::ApplicationJob < ActiveJob::Base
2
+ end
@@ -0,0 +1,4 @@
1
+ class Unidom::Authorization::ApplicationMailer < ActionMailer::Base
2
+ default from: 'from@example.com'
3
+ layout 'mailer'
4
+ end
@@ -0,0 +1,3 @@
1
+ class Unidom::Authorization::ApplicationRecord < ActiveRecord::Base
2
+ self.abstract_class = true
3
+ end
@@ -1,6 +1,6 @@
1
1
  # Authorizing 是授权。
2
2
 
3
- class Unidom::Authorization::Authorizing < ActiveRecord::Base
3
+ class Unidom::Authorization::Authorizing < Unidom::Authorization::ApplicationRecord
4
4
 
5
5
  self.table_name = 'unidom_authorizings'
6
6
 
@@ -1,6 +1,6 @@
1
1
  # Permission 是权限。
2
2
 
3
- class Unidom::Authorization::Permission < ActiveRecord::Base
3
+ class Unidom::Authorization::Permission < Unidom::Authorization::ApplicationRecord
4
4
 
5
5
  self.table_name = 'unidom_permissions'
6
6
 
@@ -1,5 +1,5 @@
1
1
  module Unidom
2
2
  module Authorization
3
- VERSION = '1.4'.freeze
3
+ VERSION = '1.4.1'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: unidom-authorization
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.4'
4
+ version: 1.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Topbit Du
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-10-02 00:00:00.000000000 Z
11
+ date: 2016-11-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: unidom-common
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '1.0'
19
+ version: '1.6'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '1.0'
26
+ version: '1.6'
27
27
  description: Unidom (UNIfied Domain Object Model) is a series of domain model engines.
28
28
  The Authorization domain model engine includes the Permission and Authorizing models.
29
29
  Unidom (统一领域对象模型)是一系列的领域模型引擎。授权领域模型引擎包括权限、授权的模型。
@@ -36,10 +36,14 @@ files:
36
36
  - MIT-LICENSE
37
37
  - README.md
38
38
  - Rakefile
39
+ - app/assets/config/unidom-authorization_manifest.js
39
40
  - app/assets/javascripts/unidom/authorization/application.js
40
41
  - app/assets/stylesheets/unidom/authorization/application.css
41
42
  - app/controllers/unidom/authorization/application_controller.rb
42
43
  - app/helpers/unidom/authorization/application_helper.rb
44
+ - app/jobs/unidom/authorization/application_job.rb
45
+ - app/mailers/unidom/authorization/application_mailer.rb
46
+ - app/models/unidom/authorization/application_record.rb
43
47
  - app/models/unidom/authorization/authorizing.rb
44
48
  - app/models/unidom/authorization/concerns/as_authorized.rb
45
49
  - app/models/unidom/authorization/concerns/as_permission.rb