# frozen_string_literal: true class ProjectPolicy < ApplicationPolicy class Scope < Scope def resolve table = Project.arel_table value = current_user.role.value role_check = (table[:role_visibility] & value).eq(value) scope.where(role_check.to_sql) end end def index? current_user.permission?(:project_view) end def show? index? end end