etherpad_canvas 1.1.2 → 1.2.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2c6b8579211d4567d2ba0ede2106b969bd658074
4
- data.tar.gz: 00642bfd1d107ef14d44a6d4df0427b3f6de50d8
3
+ metadata.gz: 298399568fd3c13b2e7ac6a9732ef6c6acbd354a
4
+ data.tar.gz: 2d125e17633e977b17040940b9aac22fdff97de7
5
5
  SHA512:
6
- metadata.gz: 2e88dee7f7b095e6a6b6230ad5ec4f1fc4cacc356f9c89d8875895cb94eac9551281f43bd5656ddfa099ddba4b734c77f6cdf37079fb85d328d575bc95e16639
7
- data.tar.gz: 4ef4199e8452bde7f7cbec6c962567ffd06f0c62fc4cdbdbac04c8453390a355297a95f15ecfb1e106573516144903b8df5774d254af0dc8afd3dd964d729fc3
6
+ metadata.gz: 0e17d81b0065b9cf832a8b76477b795fc36beac0d8c8c4cf733dc43da1719bd19ee90192e0b30966f2ab07ee27f4de604ae84773ce329586c9005282c73b24b3
7
+ data.tar.gz: 9fca27a1c9a3aeea18fdec3b76c1e60e081ac26a8f2e7e9833ecf232d1327ffcfa5931012c721e8d4e4e96266bda72e6027c657ea1e15cca8d612ba527a06e4d
@@ -14,12 +14,23 @@ Description
14
14
  Installation
15
15
  ===================================================
16
16
 
17
+ First, set up Etherpad in your Canvas instance by:
18
+
19
+ Going to 'Plugins' under the settings for your account
20
+ and enable the Etherpad plugin
21
+ >> Make sure to have the domain for your Etherpad instance
22
+
23
+ Then change into the plugins folder and clone the etherpad_canvas:
24
+
17
25
  sysadmin@appserver:~$ cd /path/to/canvas/gems/plugins
18
26
  sysadmin@appserver:/path/to/canvas/gems/plugins$ git clone https://github.com/atomicjolt/etherpad_canvas.git
19
27
 
20
- Run rake:secret and add the generated secret through
21
- Canvas settings and save that secret for utilization
22
- with the Etherpad Plugin for verification.
28
+ Run 'bundle'
29
+
30
+ Run 'rake secret' and add the generated secret through
31
+ Canvas plugin settings for 'Etherpad Security' and save
32
+ that secret for utilization with the Etherpad Plugin
33
+ for verification.
23
34
 
24
35
  ===================================================
25
36
  Usage
@@ -18,5 +18,17 @@ TEXT
18
18
  <td><%= f.blabel :key, en: "Key" %></td>
19
19
  <td><%= f.text_area :key %></td>
20
20
  </tr>
21
+ <tr>
22
+ <td colspan="2">
23
+ <p><%= t(:insecure_desc, <<-TEXT)
24
+ Select this box if your instance of Etherpad requires http instead of https
25
+ TEXT
26
+ %></p>
27
+ </td>
28
+ </tr>
29
+ <tr>
30
+ <td><%= f.blabel :insecure, en: "Insecure" %></td>
31
+ <td><%= f.check_box :insecure %></td>
32
+ </tr>
21
33
  </table>
22
34
  <% end %>
@@ -21,22 +21,56 @@ class CollaborationsController
21
21
  alias create_without_etherpad create
22
22
 
23
23
  def show
24
- show_without_etherpad
24
+ @collaboration = @context.collaborations.find(params[:id])
25
25
  if @collaboration.collaboration_type == "EtherPad"
26
- self.response_body = nil
27
- redirect_to EtherpadCollaboration.sign_url(@current_user, @collaboration)
26
+ return redirect_to EtherpadCollaboration.sign_url(@current_user, @collaboration)
27
+ else
28
+ show_without_etherpad
28
29
  end
29
30
  end
30
31
 
31
32
  def create
32
- create_without_etherpad
33
+ # This code was taken fro the original canvas controller in an effort to get around
34
+ # the limitations of Rails' version 5.0 to escape a redirect. The only changes that have
35
+ # been made from the original code are on lines 46 where a .delete was removed from between the
36
+ # params[:collaboration][:collaboration_type] and line 56
37
+ content_item = params["contentItems"] ? JSON.parse(params["contentItems"]).first : nil
38
+ if content_item
39
+ @collaboration = collaboration_from_content_item(content_item)
40
+ users, group_ids = content_item_visibility(content_item)
41
+ else
42
+ users = User.where(id: Array(params[:user])).to_a
43
+ group_ids = Array(params[:group])
44
+ collaboration_params = params.require(:collaboration).permit(:title, :description, :url)
45
+ collaboration_params[:user] = @current_user
46
+ @collaboration = Collaboration.typed_collaboration_instance(params[:collaboration][:collaboration_type])
47
+ collaboration_params.delete(:url) unless @collaboration.is_a?(ExternalToolCollaboration)
48
+ @collaboration.attributes = collaboration_params
49
+ end
50
+ @collaboration.context = @context
33
51
  if @collaboration.collaboration_type == "EtherPad"
34
52
  respond_to do |format|
35
- format.html do
36
- self.response_body = nil
37
- redirect_to EtherpadCollaboration.sign_url(@current_user, @collaboration)
53
+ if @collaboration.save
54
+ Lti::ContentItemUtil.new(content_item).success_callback if content_item
55
+ @collaboration.update_members(users, group_ids)
56
+ format.html { redirect_to EtherpadCollaboration.sign_url(@current_user, @collaboration) }
57
+ format.json {
58
+ render json: @collaboration.as_json(
59
+ methods: [:collaborator_ids], permissions: {
60
+ user: @current_user,
61
+ session: session,
62
+ }
63
+ )
64
+ }
65
+ else
66
+ Lti::ContentItemUtil.new(content_item).failure_callback if content_item
67
+ flash[:error] = t "errors.create_failed", "Collaboration creation failed"
68
+ format.html { redirect_to named_context_url(@context, :context_collaborations_url) }
69
+ format.json { render json: @collaboration.errors, status: :bad_request }
38
70
  end
39
71
  end
72
+ else
73
+ create_without_etherpad
40
74
  end
41
75
  end
42
76
  end
@@ -20,7 +20,11 @@ require "base64"
20
20
  class EtherpadCollaboration
21
21
 
22
22
  def initialize_document
23
- self.url ||= "http://#{EtherpadCollaboration.config[:domain]}/p/i-#{uuid}"
23
+ scheme = "https"
24
+ if PluginSetting.find_by(name: "etherpad_canvas").settings[:insecure] == "1"
25
+ scheme = "http"
26
+ end
27
+ self.url ||= "#{scheme}://#{EtherpadCollaboration.config[:domain]}/p/i-#{uuid}"
24
28
  end
25
29
 
26
30
  def self.sign_url(user, collaboration)
@@ -14,5 +14,5 @@
14
14
  # along with this program. If not, see <http://www.gnu.org/licenses/>.
15
15
 
16
16
  module EtherpadCanvas
17
- VERSION = "1.1.2".freeze
17
+ VERSION = "1.2.2".freeze
18
18
  end
metadata CHANGED
@@ -1,29 +1,35 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: etherpad_canvas
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 1.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Durr
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-22 00:00:00.000000000 Z
11
+ date: 2017-12-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 4.2.7.1
19
+ version: '4.2'
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '5.1'
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
- - - "~>"
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ version: '4.2'
30
+ - - "<"
25
31
  - !ruby/object:Gem::Version
26
- version: 4.2.7.1
32
+ version: '5.1'
27
33
  description: Enable secure sign-in with Etherpad collaborations tool.
28
34
  email:
29
35
  - ericdurr@atomicjolt.com
@@ -62,7 +68,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
62
68
  version: '0'
63
69
  requirements: []
64
70
  rubyforge_project:
65
- rubygems_version: 2.6.8
71
+ rubygems_version: 2.6.11
66
72
  signing_key:
67
73
  specification_version: 4
68
74
  summary: Override and add secure signin to Etherpad