Initial commit

This commit is contained in:
Senad Uka
2020-05-31 22:38:19 +02:00
commit 858fafc3c5
1280 changed files with 65918 additions and 0 deletions

View File

@@ -0,0 +1,39 @@
class ProjectPolicy < ApplicationPolicy
class Scope < Scope
def resolve
if user.account_manager?
scope.joins(account: :account_auths).where(account_auths: { user_id: user.id })
else
scope.joins(:project_memberships).where(project_memberships: { user_id: user.id })
end
end
end
def index?
true
end
def create?
user.account_manager?
end
def show?
user.project_memberships.exists?(project: record) || user.account_manager?
end
def update?
user.manager? || user.account_manager?
end
def destroy?
false
end
def show_reports?
update?
end
def show_downloads?
show?
end
end