acts_as_joinable 1.3.1 → 1.3.2
Sign up to get free protection for your applications and to get access to all the features.
@@ -2,7 +2,7 @@ class DefaultPermissionSet < ActiveRecord::Base
|
|
2
2
|
include Joinable::PermissionsAttributeWrapper
|
3
3
|
|
4
4
|
belongs_to :joinable, :polymorphic => true
|
5
|
-
has_many :permission_links, lambda { where("
|
5
|
+
has_many :permission_links, lambda { where("permission_links.joinable_type = default_permission_sets.joinable_type") }, :primary_key => :joinable_id, :foreign_key => :joinable_id
|
6
6
|
|
7
7
|
after_update :raise_existing_member_permissions
|
8
8
|
|
data/app/models/membership.rb
CHANGED
@@ -3,7 +3,7 @@ class Membership < ActiveRecord::Base
|
|
3
3
|
|
4
4
|
belongs_to :joinable, :polymorphic => true
|
5
5
|
belongs_to :user
|
6
|
-
has_many :permission_links, lambda { where("
|
6
|
+
has_many :permission_links, lambda { where("permission_links.joinable_type = memberships.joinable_type") }, :primary_key => :joinable_id, :foreign_key => :joinable_id
|
7
7
|
|
8
8
|
before_save :prevent_locked_permission_changes, :normalize_owner_permissions
|
9
9
|
|
@@ -97,7 +97,7 @@ module Joinable #:nodoc:
|
|
97
97
|
# For more information see the *recurse_to_inherit_custom_view_permission* method.
|
98
98
|
def membership_permission_exists_sql(user_id, component_id_column, permission_or_column)
|
99
99
|
memberships_allowing_permission = Membership.joins(:permission_links)
|
100
|
-
.where(
|
100
|
+
.where("user_id = #{user_id}")
|
101
101
|
.where("permission_links.component_type" => self.name)
|
102
102
|
.where("permission_links.component_id = #{component_id_column}")
|
103
103
|
.where(permission_sql_condition('memberships.permissions', permission_or_column, :raw => true))
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: acts_as_joinable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2013-08-
|
13
|
+
date: 2013-08-16 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: pg
|