openplacos 0.0.6 → 0.0.7
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.
- data/VERSION +1 -1
- data/lib/openplacos/libclient.rb +24 -2
- metadata +4 -4
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.7
|
data/lib/openplacos/libclient.rb
CHANGED
@@ -40,6 +40,8 @@ module Openplacos
|
|
40
40
|
@sensors = get_sensors
|
41
41
|
@actuators = get_actuators
|
42
42
|
@reguls = get_reguls
|
43
|
+
|
44
|
+
@permissions = Hash.new
|
43
45
|
else
|
44
46
|
puts "Can't find OpenplacOS server"
|
45
47
|
Process.exit 1
|
@@ -51,7 +53,7 @@ module Openplacos
|
|
51
53
|
def get_objects(nod, father_) #get objects from a node, ignore Debug objects
|
52
54
|
obj = Hash.new
|
53
55
|
nod.each_pair{ |key,value|
|
54
|
-
if not(key=="Debug" or key=="server") #ignore debug objects
|
56
|
+
if not(key=="Debug" or key=="server" or key=="plugins" or key=="Authenticate") #ignore debug objects
|
55
57
|
if not value.object.nil?
|
56
58
|
obj[value.object.path] = value.object
|
57
59
|
father_.push_object(value.object)
|
@@ -127,6 +129,25 @@ module Openplacos
|
|
127
129
|
reguls
|
128
130
|
end
|
129
131
|
|
132
|
+
def auth(login_,password_)
|
133
|
+
authobj = @service.object("/Authenticate")["org.openplacos.authenticate"]
|
134
|
+
ack,perm = authobj.authenticate(login_,password_)
|
135
|
+
if ack==true
|
136
|
+
if @permissions[login_].nil?
|
137
|
+
@permissions[login_] = perm
|
138
|
+
end
|
139
|
+
end
|
140
|
+
return ack
|
141
|
+
end
|
142
|
+
|
143
|
+
def readable?(path_,login_)
|
144
|
+
return @permissions[login_]["read"].include?(path_)
|
145
|
+
end
|
146
|
+
|
147
|
+
def writeable?(path_,login_)
|
148
|
+
return @permissions[login_]["write"].include?(path_)
|
149
|
+
end
|
150
|
+
|
130
151
|
end
|
131
152
|
|
132
153
|
class Room
|
@@ -157,6 +178,7 @@ module Openplacos
|
|
157
178
|
}
|
158
179
|
return hash
|
159
180
|
end
|
160
|
-
|
181
|
+
|
161
182
|
end
|
183
|
+
|
162
184
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: openplacos
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 17
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 7
|
10
|
+
version: 0.0.7
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Openplacos Team
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-06-13 00:00:00 +02:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|