torizon_audit 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/torizon_audit.rb +10 -9
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 20defd644f2091e3612517bd6bc8f8546d450910e104c246c2b785093c0cad93
4
- data.tar.gz: a3eb07db7d1d10cead1928d33d81ddd698d15ee5dbe7b1c3899888cc4964b916
3
+ metadata.gz: 81e7af01773e1433fc7489de22aefafd31c56ad3fb12cca4dd310152ce80026d
4
+ data.tar.gz: f0a52dd55c34c9d3e8ce31ccda1eb5f897c7bc51b96d7fdc8d784b7ec5b2c5f7
5
5
  SHA512:
6
- metadata.gz: 7a0bde0ecf0c0f3a7c12b5d61b563d4dd9be0034dc0fd96b34a6a7faa3a9505d810c6e347539337cefbea08d403793201b850ef3f20a44afb52e52527fa94eb7
7
- data.tar.gz: 9cd5a8cc814307ad35546ff9b3d7abda0236334b679ab749d51c8f5044536f54425f06dfb449704ffe37876bbb75e973f262bc845b86022cd036363ceae98c00
6
+ metadata.gz: f79fd5c4a081a9a118f6750780d9f1b5d678c96c67f1a44d473c90c63c9604de2ebb1ce585548ec4a6f3dc84f0b3822aa04edcda0085178f7ebc252ce25dc723
7
+ data.tar.gz: 9314b8818b0d597fc72261d4bfca3d9dbf154cb8ff32ce9a84998218f6846b7573f9a9d48c8cc24192ba409556c3edae879c068c95dd3b3de89c0f548d660c7c
data/lib/torizon_audit.rb CHANGED
@@ -24,7 +24,7 @@ class Query
24
24
 
25
25
  def initialize(maxNumLogs = 10000)
26
26
  @query = {
27
- "from" => 0,
27
+ "from" => 0,
28
28
  "size" => maxNumLogs,
29
29
  "query" => {
30
30
  "bool" => {
@@ -106,14 +106,15 @@ class Audit
106
106
  end
107
107
 
108
108
  def findAction(method, uri)
109
- @@actionsMap.each {|uriPattern, methodActions|
110
- if uri.match(uriPattern)
111
- if methodActions.key?(method)
112
- return methodActions[method]
113
- end
114
- end
115
- }
116
- return "Unknown Action"
109
+ _, m = @@actionsMap.find do |uriPattern, methodActions|
110
+ uri.match(uriPattern) && methodActions.key?(method)
111
+ end
112
+
113
+ if m.nil?
114
+ "Unknown Action"
115
+ else
116
+ m[method]
117
+ end
117
118
  end
118
119
 
119
120
  def userActions(from, to, namespace, dropUnknownActions = true)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: torizon_audit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Clouser
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-03-23 00:00:00.000000000 Z
11
+ date: 2023-03-24 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Fetch user actions from torizon platform
14
14
  email: ben.clouser@toradex.com