groupr 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +61 -11
- data/VERSION +1 -1
- data/groupr.gemspec +2 -2
- data/lib/groupr.rb +25 -31
- metadata +3 -3
data/README.rdoc
CHANGED
@@ -2,17 +2,67 @@
|
|
2
2
|
|
3
3
|
= groupr
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
*
|
12
|
-
*
|
13
|
-
*
|
14
|
-
*
|
15
|
-
|
5
|
+
Groupr provides an interface to the University of Washington Groups Service, which allows administrators to leverage a simple yet robust groups system for access control for applications campus-wide.
|
6
|
+
|
7
|
+
Groupr strives to followly closely to the naming conventions and functions as outlined in the Groups Service documentation, but does expand certain functionality, notably adding the `group_exist?` method to verify that a group exists.
|
8
|
+
|
9
|
+
== Features
|
10
|
+
|
11
|
+
* Ability to check if a group exists via Groupr#group_exists?
|
12
|
+
* Get title, description, name, regid, and contact of a group via Groupr#view_group
|
13
|
+
* Create a group and optionally add a description via Groupr#create_group
|
14
|
+
* Option to manually specify a different API url; useful if new or testing versions of the Groups Service API become available.
|
15
|
+
|
16
|
+
== System Requirements
|
17
|
+
|
18
|
+
Groupr is designed to work with a very specific application API, and is likely not useful to users not affiliated with the University of Washington. It is designed to work with a system that has:
|
19
|
+
|
20
|
+
* A static UW-assigned DNS hostname, such as hiigara.cac.washington.edu
|
21
|
+
* An X509 certificate signed by the UW Certificate Authority (UW CA)
|
22
|
+
* A copy of the UW CA root
|
23
|
+
* Permissions assigned to a stem that it is working in.
|
24
|
+
|
25
|
+
=== Note on Permissions
|
26
|
+
|
27
|
+
* This utilizes the hostname-based feature of the UW groups service. this hostname is the one assigned to you by the UW Network Operations center, and should be the same as the X509 certificate hostname as outlined above.
|
28
|
+
* When working on a group that is already created, you must assign this hsotname to one of the permissions available to you. For instance, if working on the 'u_nikky_awesome' group, you must allow 'hiigara.cac.washington.edu' as an administrator if you want to give this host full access to that group.
|
29
|
+
* When creating new groups, this host is automatically added as an administrator. You can remove this after creating the group, if desired.
|
30
|
+
* The host in question must have <insert permissions here> in order to create new groups. For instance, if 'hiigara.cac.washington.edu' has subgroup permissions for the 'u_nikky' stem, it can create subgroups such as 'u_nikky_awesomeo'
|
31
|
+
|
32
|
+
== Instructions
|
33
|
+
|
34
|
+
Once the conditions as outlined in "system requirements" are met, this gem can be utilized.
|
35
|
+
|
36
|
+
`testr = Groupr.new
|
37
|
+
testr.key = "path to key file"
|
38
|
+
testr.cert = "path to certificate file"
|
39
|
+
testr.group_exists?("u_nikky_awesome")
|
40
|
+
testr.create_group("u_nikky_yeast-lords")`
|
41
|
+
|
42
|
+
By default, it will look for a UWCA root file in ~/uwca.crt. You can manually change this by running:
|
43
|
+
|
44
|
+
`testr.ua_ca_file = "path to uwca root certificate"`
|
45
|
+
|
46
|
+
== Version History
|
47
|
+
|
48
|
+
=== 0.2.1
|
49
|
+
|
50
|
+
Initial documentation release
|
51
|
+
|
52
|
+
=== 0.1.0
|
53
|
+
|
54
|
+
Initial public release; undocumented.
|
55
|
+
|
56
|
+
== Known Issues
|
57
|
+
|
58
|
+
* Current error handling is sparse
|
59
|
+
* Many features not implemented
|
60
|
+
* Many optional features of current functions not implemented
|
61
|
+
|
62
|
+
== To-do
|
63
|
+
|
64
|
+
* Continue to expand current available options
|
65
|
+
* Additional error handling checks
|
16
66
|
|
17
67
|
== Copyright
|
18
68
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.1
|
data/groupr.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "groupr"
|
8
|
-
s.version = "0.2.
|
8
|
+
s.version = "0.2.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Nikky Southerland"]
|
12
|
-
s.date = "2012-12-
|
12
|
+
s.date = "2012-12-10"
|
13
13
|
s.description = "Gem used to interact with University of Washington Groups Service"
|
14
14
|
s.email = "nikky@uw.edu"
|
15
15
|
s.extra_rdoc_files = [
|
data/lib/groupr.rb
CHANGED
@@ -8,11 +8,7 @@ class Groupr
|
|
8
8
|
@uw_ca_file = "#{ENV['HOME']}/uwca.crt"
|
9
9
|
end
|
10
10
|
|
11
|
-
|
12
|
-
# def validate_response(response)
|
13
|
-
# nil if get_response_code != 200
|
14
|
-
# response.body if get_response_code == 200
|
15
|
-
# end
|
11
|
+
public
|
16
12
|
def get_response_code
|
17
13
|
@response.code.to_i
|
18
14
|
end
|
@@ -87,6 +83,22 @@ class Groupr
|
|
87
83
|
@group = group
|
88
84
|
description.nil? ? @description = group : @description = description
|
89
85
|
@uri = URI.parse("#{@api_url}/group/#{group}")
|
86
|
+
@request_text = %Q{<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
|
87
|
+
"http://www.w3.org/TR/xhtml11/DTD/xhtml11/dtd">
|
88
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
|
89
|
+
<head>
|
90
|
+
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8"/>
|
91
|
+
</head>
|
92
|
+
<body>
|
93
|
+
<div class="group">
|
94
|
+
<span class="description">#{@description}</span>
|
95
|
+
<ul class="names"><li class="name">#{@group}</li></ul>
|
96
|
+
<ul class="admins">
|
97
|
+
<li class="admin">nikky</li>
|
98
|
+
</ul>
|
99
|
+
</div>
|
100
|
+
</body>
|
101
|
+
</html>}
|
90
102
|
make_put_request
|
91
103
|
get_response_code == 200 ? true : false
|
92
104
|
end
|
@@ -111,6 +123,7 @@ class Groupr
|
|
111
123
|
|
112
124
|
|
113
125
|
private
|
126
|
+
# This makes a get request against the groups service, useful for getting information
|
114
127
|
def make_get_request
|
115
128
|
options = {
|
116
129
|
use_ssl: true,
|
@@ -125,7 +138,7 @@ class Groupr
|
|
125
138
|
end
|
126
139
|
@response.body
|
127
140
|
end
|
128
|
-
|
141
|
+
# This makes a put request against the groups service, useful for pushing information
|
129
142
|
def make_put_request
|
130
143
|
options = {
|
131
144
|
use_ssl: true,
|
@@ -136,49 +149,30 @@ class Groupr
|
|
136
149
|
}
|
137
150
|
Net::HTTP.start(@uri.host, @uri.port, options) do |http|
|
138
151
|
request = Net::HTTP::Put.new(@uri.request_uri)
|
139
|
-
request.body =
|
140
|
-
"http://www.w3.org/TR/xhtml11/DTD/xhtml11/dtd">
|
141
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
|
142
|
-
<head>
|
143
|
-
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8"/>
|
144
|
-
</head>
|
145
|
-
<body>
|
146
|
-
<div class="group">
|
147
|
-
<span class="description">#{@description}</span>
|
148
|
-
<ul class="names"><li class="name">#{@group}</li></ul>
|
149
|
-
<ul class="admins">
|
150
|
-
<li class="admin">nikky</li>
|
151
|
-
</ul>
|
152
|
-
</div>
|
153
|
-
</body>
|
154
|
-
</html>}
|
152
|
+
request.body = @request_text
|
155
153
|
@response = http.request(request)
|
156
154
|
end
|
157
155
|
puts "Response is: #{get_response_code}"
|
158
156
|
puts "Body is: #{@response.body}"
|
159
157
|
@response.body
|
160
158
|
end
|
161
|
-
|
162
|
-
def get_response_code
|
163
|
-
@response.code.to_i
|
164
|
-
end
|
165
|
-
|
159
|
+
# Returns the contact information of a group
|
166
160
|
def get_contact
|
167
161
|
@doc.xpath('//span[@class="contact"]').text
|
168
162
|
end
|
169
|
-
|
163
|
+
# Returns the group title
|
170
164
|
def get_title
|
171
165
|
@doc.xpath('//span[@class="title"]').text
|
172
166
|
end
|
173
|
-
|
167
|
+
# Returns the group description
|
174
168
|
def get_description
|
175
169
|
@doc.xpath('//span[@class="description"]').text
|
176
170
|
end
|
177
|
-
|
171
|
+
# Returns the group name
|
178
172
|
def get_name
|
179
173
|
@doc.xpath('//span[@class="name"]').text
|
180
174
|
end
|
181
|
-
|
175
|
+
# Returns the unique group regid
|
182
176
|
def get_regid
|
183
177
|
@doc.xpath('//span[@class="regid"]').text
|
184
178
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: groupr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-12-
|
12
|
+
date: 2012-12-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: nokogiri
|
@@ -143,7 +143,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
143
143
|
version: '0'
|
144
144
|
segments:
|
145
145
|
- 0
|
146
|
-
hash:
|
146
|
+
hash: -3689606592973473629
|
147
147
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
148
148
|
none: false
|
149
149
|
requirements:
|