phcscriptcdnpro 11.1.1 → 11.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3177e12e6b1e6c18d9570379a3e7a404facb95af
4
- data.tar.gz: 912b680645cf4bd1bd1f89b56fa896d1a0b0c7c8
3
+ metadata.gz: 9752e6aa6ca360e246d5a7655467af8419eb2e82
4
+ data.tar.gz: bd08f929ac11cb3a7f255e33db2daee36183a202
5
5
  SHA512:
6
- metadata.gz: 6d32140414a0def073adfaaecb32e910a140f901877ac232e7eea5bd5cdc6daaef6ec4ace15f8a9a95a18c110bef2ad965ef122ab5f6f1a0b7c4d368a527b951
7
- data.tar.gz: eb017191c11f78a7c8601e37b725024dd54951e544ae975ef3433ecc6d134cac73b1bfe3807379bd725c79c634f7a8386de39fe0319a3a93be16e2b85af67abe
6
+ metadata.gz: 9c3b5820bc5727a160306e799689b86c7d86c0bfda05a5b80203313cee4a8e14c5665c30d3d263ac9fefa4dcbbb6b9197a780c8f87f1e5388c5bd85765b7c736
7
+ data.tar.gz: a5962c8120dd2c4647eb4a47b0a7d70ec2d70b40ec70ad9825efe3d6d054ed67f8d887180f69c0c638ab64e2a1fabd6b309b529cd903e2aec9805fb59819be0f
@@ -31,7 +31,7 @@ module Phcscriptcdnpro
31
31
  end
32
32
  helper_method :new_login_url
33
33
 
34
- def membership_info
34
+ def authrocket_membership_info
35
35
  AuthRocket::Membership.all(user_id: current_user.id).first
36
36
  end
37
37
 
@@ -41,11 +41,6 @@ module Phcscriptcdnpro
41
41
  current_user ? current_user.username : 'Public user'
42
42
  end
43
43
 
44
- # Grab Member Information
45
- def get_member_profile_info
46
- @members_profile_info = Member::Profile.find(params[:profile_id])
47
- end
48
-
49
44
  private
50
45
 
51
46
  # PHCPress Widget Helpers
@@ -3,19 +3,21 @@ require_dependency "phcscriptcdnpro/application_controller"
3
3
  module Phcscriptcdnpro
4
4
  class Script::AuthorsController < ApplicationController
5
5
 
6
- # Filters & Security
6
+ # Security & Action Filters
7
7
  before_action :require_user
8
- before_action :membership_info
8
+ before_action :authrocket_membership_info
9
+ before_action :set_paper_trail_whodunnit
9
10
  before_action :set_script_author, only: [:show, :edit, :update, :destroy]
10
11
 
11
12
  # INDEX - Script Author
12
13
  def index
13
- @script_authors = Script::Author.all
14
+ @script_authors = Script::Author.where(oganization_id: membership_info.org_id)
14
15
  end
15
16
 
16
17
  # DETAILS - Script Author
17
18
  def show
18
19
  @script_authors = Script::Author.friendly.find(params[:id])
20
+ @versions = PaperTrail::Version.where(item_id: params[:id], item_type: 'Phcmemberspro::Directory::Category')
19
21
  end
20
22
 
21
23
  # NEW - Script Author
@@ -3,19 +3,21 @@ require_dependency "phcscriptcdnpro/application_controller"
3
3
  module Phcscriptcdnpro
4
4
  class Script::ExtensionsController < ApplicationController
5
5
 
6
- # Filters & Security
6
+ # Security & Action Filters
7
7
  before_action :require_user
8
- before_action :membership_info
8
+ before_action :authrocket_membership_info
9
+ before_action :set_paper_trail_whodunnit
9
10
  before_action :set_script_extension, only: [:show, :edit, :update, :destroy]
10
11
 
11
12
  # INDEX - Script Extension
12
13
  def index
13
- @script_extensions = Script::Extension.all
14
+ @script_extensions = Script::Extension.where(oganization_id: membership_info.org_id)
14
15
  end
15
16
 
16
17
  # DETAILS - Script Extension
17
18
  def show
18
19
  @script_extensions = Script::Extension.friendly.find(params[:id])
20
+ @versions = PaperTrail::Version.where(item_id: params[:id], item_type: 'Phcmemberspro::Directory::Category')
19
21
  end
20
22
 
21
23
  # NEW - Script Extension
@@ -69,7 +71,7 @@ module Phcscriptcdnpro
69
71
 
70
72
  # Whitelists
71
73
  def script_extension_params
72
- params.require(:script_extension).permit(:scriptextensionname, :scriptextensiondes, :scriptextension, :user_id, :user_name, :slug, :membership_id, :oganization_id)
74
+ params.require(:script_extension).permit(:scriptextensionname, :scriptextensiondes, :scriptextension, :slug, :user_id, :user_name, :membership_id, :oganization_id)
73
75
  end
74
76
 
75
77
  end
@@ -3,19 +3,21 @@ require_dependency "phcscriptcdnpro/application_controller"
3
3
  module Phcscriptcdnpro
4
4
  class Script::LicencesController < ApplicationController
5
5
 
6
- # Filters & Security
6
+ # Security & Action Filters
7
7
  before_action :require_user
8
- before_action :membership_info
8
+ before_action :authrocket_membership_info
9
+ before_action :set_paper_trail_whodunnit
9
10
  before_action :set_script_licence, only: [:show, :edit, :update, :destroy]
10
11
 
11
12
  # INDEX - Script Licences
12
13
  def index
13
- @script_licences = Script::Licence.all
14
+ @script_licences = Script::Licence.where(oganization_id: membership_info.org_id)
14
15
  end
15
16
 
16
17
  # DETAILS - Script Licences
17
18
  def show
18
19
  @script_licences = Script::Licence.friendly.find(params[:id])
20
+ @versions = PaperTrail::Version.where(item_id: params[:id], item_type: 'Phcmemberspro::Directory::Category')
19
21
  end
20
22
 
21
23
  # NEW - Script Licences
@@ -69,7 +71,7 @@ module Phcscriptcdnpro
69
71
 
70
72
  # Whitelists
71
73
  def script_licence_params
72
- params.require(:script_licence).permit(:lcncname, :lcncdescription, :lcncdescript, :lcnccomgpl, :lcncarvlfsf, :lcncarvlosi, :lcncarvlcopyfree, :lcncarvldebian, :lcncarvlfedora, :user_id, :slug, :user_name, :membership_id, :oganization_id)
74
+ params.require(:script_licence).permit(:lcncname, :lcncdescription, :lcncdescript, :lcnccomgpl, :lcncarvlfsf, :lcncarvlosi, :lcncarvlcopyfree, :lcncarvldebian, :lcncarvlfedora, :slug, :user_id, :user_name, :membership_id, :oganization_id)
73
75
  end
74
76
 
75
77
  end
@@ -3,19 +3,21 @@ require_dependency "phcscriptcdnpro/application_controller"
3
3
  module Phcscriptcdnpro
4
4
  class Script::ListingsController < ApplicationController
5
5
 
6
- # Filters & Security
6
+ # Security & Action Filters
7
7
  before_action :require_user
8
- before_action :membership_info
8
+ before_action :authrocket_membership_info
9
+ before_action :set_paper_trail_whodunnit
9
10
  before_action :set_script_listing, only: [:show, :edit, :update, :destroy]
10
11
 
11
12
  # INDEX - Script Listings
12
13
  def index
13
- @script_listings = Script::Listing.all
14
+ @script_listings = Script::Listing.where(oganization_id: membership_info.org_id)
14
15
  end
15
16
 
16
17
  # DETAILS - Script Listings
17
18
  def show
18
19
  @script_listings = Script::Listing.friendly.find(params[:id])
20
+ @versions = PaperTrail::Version.where(item_id: params[:id], item_type: 'Phcmemberspro::Directory::Category')
19
21
  end
20
22
 
21
23
  # NEW - Script Listings
@@ -3,9 +3,10 @@ require_dependency "phcscriptcdnpro/application_controller"
3
3
  module Phcscriptcdnpro
4
4
  class Script::UrlsController < ApplicationController
5
5
 
6
- # Filters & Security
6
+ # Security & Action Filters
7
7
  before_action :require_user
8
- before_action :membership_info
8
+ before_action :authrocket_membership_info
9
+ before_action :set_paper_trail_whodunnit
9
10
  before_action :set_script_url, only: [:show, :edit, :update, :destroy]
10
11
 
11
12
  # INDEX - Script Authors
@@ -3,19 +3,21 @@ require_dependency "phcscriptcdnpro/application_controller"
3
3
  module Phcscriptcdnpro
4
4
  class Script::VersionsController < ApplicationController
5
5
 
6
- # Filters & Security
6
+ # Security & Action Filters
7
7
  before_action :require_user
8
- before_action :membership_info
8
+ before_action :authrocket_membership_info
9
+ before_action :set_paper_trail_whodunnit
9
10
  before_action :set_script_version, only: [:show, :edit, :update, :destroy]
10
11
 
11
12
  # INDEX - Script Versions
12
13
  def index
13
- @script_versions = Script::Version.all
14
+ @script_versions = Script::Version.where(oganization_id: membership_info.org_id)
14
15
  end
15
16
 
16
17
  # DETAILS - Script Versions
17
18
  def show
18
19
  @script_versions = Script::Version.friendly.find(params[:id])
20
+ @versions = PaperTrail::Version.where(item_id: params[:id], item_type: 'Phcmemberspro::Directory::Category')
19
21
  end
20
22
 
21
23
  # NEW - Script Versions
@@ -69,7 +71,7 @@ module Phcscriptcdnpro
69
71
 
70
72
  # Only allow a trusted parameter "white list" through.
71
73
  def script_version_params
72
- params.require(:script_version).permit(:scriptversion, :user_id, :user_name, :slug, :membership_id, :oganization_id)
74
+ params.require(:script_version).permit(:scriptversion, :slug, :user_id, :user_name, :membership_id, :oganization_id)
73
75
  end
74
76
 
75
77
  end
@@ -4,7 +4,10 @@ module Phcscriptcdnpro
4
4
  # Clean URL Initialize
5
5
  extend FriendlyId
6
6
 
7
- # Listing (None Nested)
7
+ # Add Paper Trail
8
+ has_paper_trail
9
+
10
+ # Model Relationships
8
11
  has_many :listings, class_name: 'Phcscriptcdnpro::Script::Listing'
9
12
 
10
13
  # Clean URL Define
@@ -4,7 +4,10 @@ module Phcscriptcdnpro
4
4
  # Clean URL Initialize
5
5
  extend FriendlyId
6
6
 
7
- # URLs & Extensions (None Nested)
7
+ # Add Paper Trail
8
+ has_paper_trail
9
+
10
+ # Model Relationships
8
11
  has_many :listings, class_name: 'Phcscriptcdnpro::Script::Listing', :through => :urls
9
12
  has_many :urls, class_name: 'Phcscriptcdnpro::Script::Url'
10
13
 
@@ -4,7 +4,10 @@ module Phcscriptcdnpro
4
4
  # Clean URL Initialize
5
5
  extend FriendlyId
6
6
 
7
- # Listing (None Nested)
7
+ # Add Paper Trail
8
+ has_paper_trail
9
+
10
+ # Model Relationships
8
11
  has_many :listings, class_name: 'Phcscriptcdnpro::Script::Listing'
9
12
 
10
13
  # Clean URL Define
@@ -4,7 +4,10 @@ module Phcscriptcdnpro
4
4
  # Clean URL Initialize
5
5
  extend FriendlyId
6
6
 
7
- # Attach to URL (Nested)
7
+ # Add Paper Trail
8
+ has_paper_trail
9
+
10
+ # Model Relationships
8
11
  has_many :urls, class_name: 'Phcscriptcdnpro::Script::Url'
9
12
 
10
13
  # Attach to Author (None Nested)
@@ -4,7 +4,10 @@ module Phcscriptcdnpro
4
4
  # Clean URL Initialize
5
5
  extend FriendlyId
6
6
 
7
- # Attach to Listings (Nested)
7
+ # Add Paper Trail
8
+ has_paper_trail
9
+
10
+ # Model Relationships
8
11
  belongs_to :listing, class_name: 'Phcscriptcdnpro::Script::Listing'
9
12
 
10
13
  # Attach to Version (None Nested)
@@ -4,7 +4,10 @@ module Phcscriptcdnpro
4
4
  # Clean URL Initialize
5
5
  extend FriendlyId
6
6
 
7
- # Attach to Listing (None Nested)
7
+ # Add Paper Trail
8
+ has_paper_trail
9
+
10
+ # Model Relationships
8
11
  has_many :listings, class_name: 'Phcscriptcdnpro::Script::Listing'
9
12
 
10
13
  # Attach to URL (None Nested)
@@ -4,5 +4,5 @@
4
4
  <% end %>
5
5
  </div>
6
6
  <div>
7
- &copy; 2012-<%= Time.now.year %> - v11.1.1 - RELEASED - MAY-12-<%= Date.today.year %>
7
+ &copy; 2012-<%= Time.now.year %> - v11.2.0 - RELEASED - MAY-12-<%= Date.today.year %>
8
8
  </div>
@@ -0,0 +1,80 @@
1
+ # This migration creates the `versions` table, the only schema PT requires.
2
+ # All other migrations PT provides are optional.
3
+ class CreatePhcscriptcdnproVersions < ActiveRecord::Migration[5.1]
4
+ # Class names of MySQL adapters.
5
+ # - `MysqlAdapter` - Used by gems: `mysql`, `activerecord-jdbcmysql-adapter`.
6
+ # - `Mysql2Adapter` - Used by `mysql2` gem.
7
+ MYSQL_ADAPTERS = [
8
+ "ActiveRecord::ConnectionAdapters::MysqlAdapter",
9
+ "ActiveRecord::ConnectionAdapters::Mysql2Adapter"
10
+ ].freeze
11
+
12
+ # The largest text column available in all supported RDBMS is
13
+ # 1024^3 - 1 bytes, roughly one gibibyte. We specify a size
14
+ # so that MySQL will use `longtext` instead of `text`. Otherwise,
15
+ # when serializing very large objects, `text` might not be big enough.
16
+ TEXT_BYTES = 1_073_741_823
17
+
18
+ def change
19
+ create_table :versions, versions_table_options do |t|
20
+ t.string :item_type, item_type_options
21
+ t.integer :item_id, null: false
22
+ t.string :event, null: false
23
+ t.string :whodunnit
24
+ t.text :object, limit: TEXT_BYTES
25
+
26
+ # Known issue in MySQL: fractional second precision
27
+ # -------------------------------------------------
28
+ #
29
+ # MySQL timestamp columns do not support fractional seconds unless
30
+ # defined with "fractional seconds precision". MySQL users should manually
31
+ # add fractional seconds precision to this migration, specifically, to
32
+ # the `created_at` column.
33
+ # (https://dev.mysql.com/doc/refman/5.6/en/fractional-seconds.html)
34
+ #
35
+ # MySQL users should also upgrade to rails 4.2, which is the first
36
+ # version of ActiveRecord with support for fractional seconds in MySQL.
37
+ # (https://github.com/rails/rails/pull/14359)
38
+ #
39
+ t.datetime :created_at
40
+ end
41
+ add_index :versions, [:item_type, :item_id]
42
+ end
43
+
44
+ private
45
+
46
+ # MySQL 5.6 utf8mb4 limit is 191 chars for keys used in indexes.
47
+ # See https://github.com/airblade/paper_trail/issues/651
48
+ def item_type_options
49
+ opt = { null: false }
50
+ opt[:limit] = 191 if mysql?
51
+ opt
52
+ end
53
+
54
+ def mysql?
55
+ MYSQL_ADAPTERS.include?(connection.class.name)
56
+ end
57
+
58
+ # Even modern versions of MySQL still use `latin1` as the default character
59
+ # encoding. Many users are not aware of this, and run into trouble when they
60
+ # try to use PaperTrail in apps that otherwise tend to use UTF-8. Postgres, by
61
+ # comparison, uses UTF-8 except in the unusual case where the OS is configured
62
+ # with a custom locale.
63
+ #
64
+ # - https://dev.mysql.com/doc/refman/5.7/en/charset-applications.html
65
+ # - http://www.postgresql.org/docs/9.4/static/multibyte.html
66
+ #
67
+ # Furthermore, MySQL's original implementation of UTF-8 was flawed, and had
68
+ # to be fixed later by introducing a new charset, `utf8mb4`.
69
+ #
70
+ # - https://mathiasbynens.be/notes/mysql-utf8mb4
71
+ # - https://dev.mysql.com/doc/refman/5.5/en/charset-unicode-utf8mb4.html
72
+ #
73
+ def versions_table_options
74
+ if mysql?
75
+ { options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci" }
76
+ else
77
+ {}
78
+ end
79
+ end
80
+ end
@@ -1,3 +1,3 @@
1
1
  module Phcscriptcdnpro
2
- VERSION = "11.1.1"
2
+ VERSION = "11.2.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: phcscriptcdnpro
3
3
  version: !ruby/object:Gem::Version
4
- version: 11.1.1
4
+ version: 11.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - BradPotts
@@ -710,6 +710,7 @@ files:
710
710
  - app/views/phcscriptcdnpro/script/versions/show.html.erb
711
711
  - config/initializers/friendly_id.rb
712
712
  - config/routes.rb
713
+ - db/migrate/20160714193304_create_phcscriptcdnpro_versions.rb
713
714
  - db/migrate/20160821183652_create_phcscriptcdnpro_script_listings.rb
714
715
  - db/migrate/20160821183714_create_phcscriptcdnpro_script_authors.rb
715
716
  - db/migrate/20160821183735_create_phcscriptcdnpro_script_extensions.rb
@@ -744,5 +745,5 @@ rubyforge_project:
744
745
  rubygems_version: 2.6.8
745
746
  signing_key:
746
747
  specification_version: 4
747
- summary: Rails 5.1 Engine - Script Listings
748
+ summary: Rails 5.1 Engine - Script Listing Management
748
749
  test_files: []