@ symbols unneeded
This commit is contained in:
parent
895b872bda
commit
155eac41d8
3 changed files with 18 additions and 18 deletions
|
@ -1,12 +1,12 @@
|
||||||
class MapPolicy < ApplicationPolicy
|
class MapPolicy < ApplicationPolicy
|
||||||
class Scope < Scope
|
class Scope < Scope
|
||||||
def resolve
|
def resolve
|
||||||
scope.where('permission IN ("public", "commons") OR user_id = ?', @user.id)
|
scope.where('permission IN ("public", "commons") OR user_id = ?', user.id)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def activemaps?
|
def activemaps?
|
||||||
@user.blank? # redirect to root url if authenticated for some reason
|
user.blank? # redirect to root url if authenticated for some reason
|
||||||
end
|
end
|
||||||
|
|
||||||
def featuredmaps?
|
def featuredmaps?
|
||||||
|
@ -14,7 +14,7 @@ class MapPolicy < ApplicationPolicy
|
||||||
end
|
end
|
||||||
|
|
||||||
def mymaps?
|
def mymaps?
|
||||||
@user.present?
|
user.present?
|
||||||
end
|
end
|
||||||
|
|
||||||
def usermaps?
|
def usermaps?
|
||||||
|
@ -22,7 +22,7 @@ class MapPolicy < ApplicationPolicy
|
||||||
end
|
end
|
||||||
|
|
||||||
def show?
|
def show?
|
||||||
@record.permission == 'commons' || @record.permission == 'public' || @record.user == @user
|
record.permission == 'commons' || record.permission == 'public' || record.user == user
|
||||||
end
|
end
|
||||||
|
|
||||||
def contains?
|
def contains?
|
||||||
|
@ -30,11 +30,11 @@ class MapPolicy < ApplicationPolicy
|
||||||
end
|
end
|
||||||
|
|
||||||
def create?
|
def create?
|
||||||
@user.present?
|
user.present?
|
||||||
end
|
end
|
||||||
|
|
||||||
def update?
|
def update?
|
||||||
@user.present? && (@record.permission == 'commons' || @record.user == @user)
|
user.present? && (record.permission == 'commons' || record.user == user)
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -43,6 +43,6 @@ class MapPolicy < ApplicationPolicy
|
||||||
end
|
end
|
||||||
|
|
||||||
def destroy?
|
def destroy?
|
||||||
@record.user == @user || @user.admin
|
record.user == user || user.admin
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,25 +1,25 @@
|
||||||
class SynapsePolicy < ApplicationPolicy
|
class SynapsePolicy < ApplicationPolicy
|
||||||
class Scope < Scope
|
class Scope < Scope
|
||||||
def resolve
|
def resolve
|
||||||
scope.where('permission IN ("public", "commons") OR user_id = ?', @user.id)
|
scope.where('permission IN ("public", "commons") OR user_id = ?', user.id)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def create?
|
def create?
|
||||||
@user.present?
|
user.present?
|
||||||
end
|
end
|
||||||
|
|
||||||
def show?
|
def show?
|
||||||
# @record.permission == 'commons' || @record.permission == 'public' || @record.user == @user
|
# record.permission == 'commons' || record.permission == 'public' || record.user == user
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|
||||||
def update?
|
def update?
|
||||||
# @user.present? && (@record.permission == 'commons' || @record.user == @user)
|
# user.present? && (record.permission == 'commons' || record.user == user)
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|
||||||
def destroy?
|
def destroy?
|
||||||
@record.user == @user || @user.admin
|
record.user == user || user.admin
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,29 +1,29 @@
|
||||||
class TopicPolicy < ApplicationPolicy
|
class TopicPolicy < ApplicationPolicy
|
||||||
class Scope < Scope
|
class Scope < Scope
|
||||||
def resolve
|
def resolve
|
||||||
scope.where('permission IN ("public", "commons") OR user_id = ?', @user.id)
|
scope.where('permission IN ("public", "commons") OR user_id = ?', user.id)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def create?
|
def create?
|
||||||
@user.present?
|
user.present?
|
||||||
end
|
end
|
||||||
|
|
||||||
def show?
|
def show?
|
||||||
@record.permission == 'commons' || @record.permission == 'public' || @record.user == @user
|
record.permission == 'commons' || record.permission == 'public' || record.user == user
|
||||||
end
|
end
|
||||||
|
|
||||||
def update?
|
def update?
|
||||||
# @user.present? && (@record.permission == 'commons' || @record.user == @user)
|
# user.present? && (record.permission == 'commons' || record.user == user)
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|
||||||
def destroy?
|
def destroy?
|
||||||
@record.user == @user || @user.admin
|
record.user == user || user.admin
|
||||||
end
|
end
|
||||||
|
|
||||||
def autocomplete_topic?
|
def autocomplete_topic?
|
||||||
@user.present?
|
user.present?
|
||||||
end
|
end
|
||||||
|
|
||||||
def network?
|
def network?
|
||||||
|
|
Loading…
Reference in a new issue