miau 1.1.7 → 1.1.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/MIT-LICENSE +0 -2
- data/README.md +4 -1
- data/lib/miau/version.rb +3 -1
- data/lib/miau/version.rb.bak +4 -1
- metadata +20 -8
- data/lib/miau/error.rb.bak +0 -10
- data/lib/miau.rb.bak +0 -74
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e8cc7ff577168357fb277d134fa4ef13b2a4474596490cf8c985b67ec4cd0f3c
|
4
|
+
data.tar.gz: ac8986cf724bf7d6c294a4743016a0b1a4e85b04f42603c075b56279c596fc0a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2a4c85dd96321208a6e82514324167548023b682ee3223f46fa846e131f93566b8539ad25ba8a2bc76cf4bde7e178b6114fb87535c0d81cc85912193b5e63489
|
7
|
+
data.tar.gz: d0b727e3a439e34b20208c3e070e4d63958da4c5a03d7e018cf69a1847e5ee32df7dc32564ca016272fd0db691ada524c09f1fab5607e7e6c18912a62db5c195
|
data/MIT-LICENSE
CHANGED
data/README.md
CHANGED
@@ -1,7 +1,10 @@
|
|
1
1
|
# Miau
|
2
2
|
|
3
|
-
[![Gem Version](https://badge.fury.io/rb/miau.
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/miau.svg)](http://badge.fury.io/rb/miau)
|
4
4
|
[![GEM Downloads](https://img.shields.io/gem/dt/miau?color=168AFE&logo=ruby&logoColor=FE1616)](https://rubygems.org/gems/miau)
|
5
|
+
[![rake](https://github.com/matique/miau/actions/workflows/rake.yml/badge.svg)](https://github.com/matique/miau/actions/workflows/rake.yml)
|
6
|
+
[![Ruby Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://github.com/standardrb/standard)
|
7
|
+
[![MIT License](https://img.shields.io/badge/license-MIT-blue.svg)](http://choosealicense.com/licenses/mit/)
|
5
8
|
|
6
9
|
Miau (MIcro AUthorization) is a simple authorization gem for Rails
|
7
10
|
inspired by Pundit and Banken.
|
data/lib/miau/version.rb
CHANGED
@@ -1,7 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Miau
|
4
|
-
VERSION = "1.1.
|
4
|
+
VERSION = "1.1.10" # 2024-10-20
|
5
|
+
# VERSION = "1.1.8" # 2024-04-29
|
6
|
+
# VERSION = "1.1.7" # 2024-04-24
|
5
7
|
# VERSION = "1.1.6" # 2024-01-13
|
6
8
|
# VERSION = "1.1.1" # 2024-01-06
|
7
9
|
# VERSION = "1.1.0" # 2024-01-06
|
data/lib/miau/version.rb.bak
CHANGED
@@ -1,7 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Miau
|
4
|
-
VERSION = "1.1.
|
4
|
+
VERSION = "1.1.9" # 2024-10-20
|
5
|
+
# VERSION = "1.1.8" # 2024-04-29
|
6
|
+
# VERSION = "1.1.7" # 2024-04-24
|
7
|
+
# VERSION = "1.1.6" # 2024-01-13
|
5
8
|
# VERSION = "1.1.1" # 2024-01-06
|
6
9
|
# VERSION = "1.1.0" # 2024-01-06
|
7
10
|
# VERSION = "1.0.3" # 2023-12-13
|
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: miau
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dittmar Krall
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-10-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: listen
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: appraisal
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -79,10 +93,8 @@ files:
|
|
79
93
|
- MIT-LICENSE
|
80
94
|
- README.md
|
81
95
|
- lib/miau.rb
|
82
|
-
- lib/miau.rb.bak
|
83
96
|
- lib/miau/application_policy.rb
|
84
97
|
- lib/miau/error.rb
|
85
|
-
- lib/miau/error.rb.bak
|
86
98
|
- lib/miau/run.rb
|
87
99
|
- lib/miau/storage.rb
|
88
100
|
- lib/miau/version.rb
|
@@ -91,7 +103,7 @@ homepage: https://github.com/matique/miau
|
|
91
103
|
licenses:
|
92
104
|
- MIT
|
93
105
|
metadata: {}
|
94
|
-
post_install_message:
|
106
|
+
post_install_message:
|
95
107
|
rdoc_options: []
|
96
108
|
require_paths:
|
97
109
|
- lib
|
@@ -106,8 +118,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
106
118
|
- !ruby/object:Gem::Version
|
107
119
|
version: '0'
|
108
120
|
requirements: []
|
109
|
-
rubygems_version: 3.5.
|
110
|
-
signing_key:
|
121
|
+
rubygems_version: 3.5.20
|
122
|
+
signing_key:
|
111
123
|
specification_version: 4
|
112
124
|
summary: Simple and lightweight authorization solution for Rails.
|
113
125
|
test_files: []
|
data/lib/miau/error.rb.bak
DELETED
data/lib/miau.rb.bak
DELETED
@@ -1,74 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "active_support/concern"
|
4
|
-
require "miau/version"
|
5
|
-
require "miau/error"
|
6
|
-
require "miau/storage"
|
7
|
-
require "miau/run"
|
8
|
-
require "miau/application_policy"
|
9
|
-
|
10
|
-
module Miau
|
11
|
-
extend ActiveSupport::Concern
|
12
|
-
|
13
|
-
included do
|
14
|
-
if respond_to?(:helper_method)
|
15
|
-
helper_method :authorized?
|
16
|
-
helper_method :miau_user
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
def authorize!(resource = nil, hsh = {})
|
21
|
-
@_miau_authorization_performed = true
|
22
|
-
return true if authorized?(resource, hsh)
|
23
|
-
|
24
|
-
controller = params[:controller].to_sym
|
25
|
-
action = params[:action].to_sym
|
26
|
-
PolicyRun.instance.raise_authorize(controller, action)
|
27
|
-
end
|
28
|
-
|
29
|
-
def authorized?(resource = nil, hsh = {})
|
30
|
-
controller = params[:controller].to_sym
|
31
|
-
action = params[:action].to_sym
|
32
|
-
policy = PolicyStorage.instance.find_or_create_policy(controller)
|
33
|
-
PolicyRun.instance.raise_undef(policy, action) unless policy
|
34
|
-
|
35
|
-
policy.user = miau_user
|
36
|
-
policy.resource = resource
|
37
|
-
methods = PolicyRun.instance.find_methods(policy, controller, action)
|
38
|
-
PolicyRun.instance.raise_undef(policy, action) unless methods
|
39
|
-
|
40
|
-
PolicyRun.instance.runs(policy, methods)
|
41
|
-
end
|
42
|
-
|
43
|
-
def authorize_controller!
|
44
|
-
controller = params[:controller].to_sym
|
45
|
-
action = params[:action].to_sym
|
46
|
-
policy = PolicyStorage.instance.find_or_create_policy(controller)
|
47
|
-
p 22222
|
48
|
-
unless policy
|
49
|
-
p 11111111111111
|
50
|
-
# msg = "undefined class #{controller.capitalize}Policy"
|
51
|
-
# raise NotDefinedError, msg
|
52
|
-
end
|
53
|
-
|
54
|
-
policy.user = miau_user
|
55
|
-
policy.action = action
|
56
|
-
|
57
|
-
@_miau_authorization_performed = true
|
58
|
-
return true if PolicyRun.instance.runs(policy, :controller)
|
59
|
-
|
60
|
-
PolicyRun.instance.raise_authorize policy, action
|
61
|
-
end
|
62
|
-
|
63
|
-
def miau_user
|
64
|
-
current_user
|
65
|
-
end
|
66
|
-
|
67
|
-
def verify_authorized
|
68
|
-
raise AuthorizationNotPerformedError unless miau_authorization_performed?
|
69
|
-
end
|
70
|
-
|
71
|
-
def miau_authorization_performed?
|
72
|
-
!!@_miau_authorization_performed
|
73
|
-
end
|
74
|
-
end
|