* Change models and related files * Update controllers and specs * More renaming * Seek and destroy, I mean search and replace * Round up the stragglers * Ground control to Major Travis... * More fixes * PR feedback * Various fixes * Rename view * Fix list query builder * Unify request specs * Fix some API spec errors * Fix remaining API specs * Make spec conform to API * Fix leftover problems * Fix JS tests * Fix column name in select * Fix API specs * Fix search specs * Paging Mr. Travis
31 lines
535 B
Ruby
31 lines
535 B
Ruby
class ListingPolicy < ApplicationPolicy
|
|
def edit?
|
|
user_is_author? || authorized_organization_admin_editor?
|
|
end
|
|
|
|
def update?
|
|
user_is_author? || authorized_organization_admin_editor?
|
|
end
|
|
|
|
def authorized_organization_poster?
|
|
user.org_member?(record.organization_id)
|
|
end
|
|
|
|
def delete_confirm?
|
|
update?
|
|
end
|
|
|
|
def destroy?
|
|
update?
|
|
end
|
|
|
|
private
|
|
|
|
def user_is_author?
|
|
record.user_id == user.id
|
|
end
|
|
|
|
def authorized_organization_admin_editor?
|
|
user.org_admin?(record.organization_id)
|
|
end
|
|
end
|