leofs_manager_client 0.2.11 → 0.2.12
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.
@@ -135,16 +135,16 @@ module LeoFSManager
|
|
135
135
|
end
|
136
136
|
end
|
137
137
|
|
138
|
+
RoleDef = {
|
139
|
+
1 => :normal,
|
140
|
+
9 => :admin
|
141
|
+
}
|
142
|
+
RoleDef.default_proc = proc {|_, key| raise "invalid @user_id: #{key}" }
|
143
|
+
RoleDef.freeze
|
144
|
+
|
138
145
|
class LoginInfo
|
139
146
|
attr_reader :id, :role_id, :access_key_id, :secret_key, :created_at
|
140
147
|
|
141
|
-
RoleDef = {
|
142
|
-
1 => :normal,
|
143
|
-
9 => :admin
|
144
|
-
}
|
145
|
-
RoleDef.default_proc = proc {|_, key| raise "invalid @user_id: #{key}" }
|
146
|
-
RoleDef.freeze
|
147
|
-
|
148
148
|
def initialize(h)
|
149
149
|
h = h[:user]
|
150
150
|
@id = h[:id]
|
@@ -160,7 +160,7 @@ module LeoFSManager
|
|
160
160
|
end
|
161
161
|
|
162
162
|
class User
|
163
|
-
attr_reader :user_id, :access_key_id, :created_at
|
163
|
+
attr_reader :user_id, :role_id, :access_key_id, :created_at
|
164
164
|
|
165
165
|
def initialize(h)
|
166
166
|
@user_id = h[:user_id]
|
@@ -168,6 +168,10 @@ module LeoFSManager
|
|
168
168
|
@access_key_id = h[:access_key_id]
|
169
169
|
@created_at = Time.parse(h[:created_at])
|
170
170
|
end
|
171
|
+
|
172
|
+
def role
|
173
|
+
RoleDef[@role_id]
|
174
|
+
end
|
171
175
|
end
|
172
176
|
|
173
177
|
# Endpoint
|
data/lib/leofs_manager_client.rb
CHANGED
@@ -26,7 +26,7 @@ require "time"
|
|
26
26
|
require_relative "leofs_manager_client/leofs_manager_models"
|
27
27
|
|
28
28
|
module LeoFSManager
|
29
|
-
VERSION = "0.2.
|
29
|
+
VERSION = "0.2.12"
|
30
30
|
|
31
31
|
class Client
|
32
32
|
CMD_VERSION = "version"
|
@@ -52,7 +52,7 @@ module LeoFSManager
|
|
52
52
|
CMD_S3_ADD_BUCKET = "s3-add-bucket %s %s"
|
53
53
|
CMD_S3_GET_BUCKETS = "s3-get-buckets"
|
54
54
|
|
55
|
-
USER_ROLES =
|
55
|
+
USER_ROLES = RoleDef.invert
|
56
56
|
|
57
57
|
# ======================================================================
|
58
58
|
# APIs
|