canvas_connect 0.0.9 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/adobe_connect_conference.rb +29 -2
- data/lib/canvas_connect/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b78cf0edc21638b06e639c666bcd9256646dd93a
|
4
|
+
data.tar.gz: 3f92a2cf1aa6fa71844742663d0a520c3f9398fb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b0b9419da7ee66e6f63f8b99166eaac2fc6144931329de7350321b452c16d90a5c443316a601da462c17260ee2d4a7482b61d6c4cee19f4be0a609abb39caf70
|
7
|
+
data.tar.gz: f1a7c1a1df733b26493ac64f1e3e462a7c925784a2d3fbcfb0da721c9433adc94ceb9e7f2b34a50ed87eed3b9713e30dcf053cfb99b6b0a6a6bac41aded6a83f
|
@@ -18,6 +18,8 @@
|
|
18
18
|
|
19
19
|
class AdobeConnectConference < WebConference
|
20
20
|
|
21
|
+
MAX_USERNAME_LENGTH = 60
|
22
|
+
|
21
23
|
# Public: Start a new conference and return its key. (required by WebConference)
|
22
24
|
#
|
23
25
|
# Returns a conference key string.
|
@@ -98,9 +100,8 @@ class AdobeConnectConference < WebConference
|
|
98
100
|
#
|
99
101
|
# Returns the CanvasConnect::ConnectUser.
|
100
102
|
def add_host(user)
|
101
|
-
connect_email = user.email.gsub(/@/, "+canvas-#{user.uuid}@")
|
102
103
|
options = { first_name: user.first_name, last_name: user.last_name,
|
103
|
-
email:
|
104
|
+
email: connect_username(user), username: connect_username(user), uuid: user.uuid }
|
104
105
|
|
105
106
|
connect_user = AdobeConnect::User.find(options) || AdobeConnect::User.create(options)
|
106
107
|
connect_service.permissions_update(
|
@@ -111,6 +112,32 @@ class AdobeConnectConference < WebConference
|
|
111
112
|
connect_user
|
112
113
|
end
|
113
114
|
|
115
|
+
# Internal: Generate a Connect username that is under 60 characters
|
116
|
+
# (the username limit on our Connect instance).
|
117
|
+
#
|
118
|
+
# user - The Canvas user to generate a username for.
|
119
|
+
#
|
120
|
+
# Returns a username string.
|
121
|
+
def connect_username(user)
|
122
|
+
return @connect_username unless @connect_username.nil?
|
123
|
+
|
124
|
+
preferred_extension = 'canvas-connect'
|
125
|
+
current_address = user.email
|
126
|
+
allowed_length = MAX_USERNAME_LENGTH - current_address.length
|
127
|
+
allowed_length -= 1 unless current_address.match(/\+/)
|
128
|
+
postfix = if allowed_length >= preferred_extension.length
|
129
|
+
preferred_extension
|
130
|
+
else
|
131
|
+
user.uuid[0..allowed_length - 1]
|
132
|
+
end
|
133
|
+
|
134
|
+
@connect_username = if current_address.match(/\+/)
|
135
|
+
current_address.gsub(/\+/, "+#{postfix}")
|
136
|
+
else
|
137
|
+
current_address.gsub(/@/, "+#{postfix}@")
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
114
141
|
# Internal: Create a new Connect meeting.
|
115
142
|
#
|
116
143
|
# Returns nothing.
|