Sha256: 83168eddb1d51688876e5f61581dad275c3281f249619511b3a4d4988d641f21

Contents?: true

Size: 539 Bytes

Versions: 40

Compression:

Stored size: 539 Bytes

Contents

module Scrivito
  class PublishAbility < Struct.new(:user, :workspace, :obj)
    def self.mget(user, workspace, obj_ids)
      objs = workspace.objs.find_including_deleted(obj_ids)

      obj_ids.map do |obj_id|
        PublishAbility.new(user, workspace, objs.find { |obj| obj.id == obj_id })
      end
    end

    def as_json
      { restriction_messages: restriction_messages }
    end

    private

    def restriction_messages
      if obj
        user.restriction_messages_for(obj)
      else
        []
      end
    end
  end
end

Version data entries

40 entries across 40 versions & 1 rubygems

Version Path
scrivito_sdk-1.18.0 app/cms/scrivito/publish_ability.rb
scrivito_sdk-1.18.0.rc1 app/cms/scrivito/publish_ability.rb
scrivito_sdk-1.17.0 app/cms/scrivito/publish_ability.rb
scrivito_sdk-1.17.0.rc3 app/cms/scrivito/publish_ability.rb
scrivito_sdk-1.17.0.rc2 app/cms/scrivito/publish_ability.rb
scrivito_sdk-1.17.0.rc1 app/cms/scrivito/publish_ability.rb
scrivito_sdk-1.16.0 app/cms/scrivito/publish_ability.rb
scrivito_sdk-1.16.0.rc2 app/cms/scrivito/publish_ability.rb
scrivito_sdk-1.16.0.rc1 app/cms/scrivito/publish_ability.rb
scrivito_sdk-1.15.0 app/cms/scrivito/publish_ability.rb
scrivito_sdk-1.15.0.rc2 app/cms/scrivito/publish_ability.rb
scrivito_sdk-1.15.0.rc1 app/cms/scrivito/publish_ability.rb
scrivito_sdk-1.14.0 app/cms/scrivito/publish_ability.rb
scrivito_sdk-1.14.0.rc3 app/cms/scrivito/publish_ability.rb
scrivito_sdk-1.14.0.rc2 app/cms/scrivito/publish_ability.rb
scrivito_sdk-1.14.0.rc1 app/cms/scrivito/publish_ability.rb
scrivito_sdk-1.13.0 app/cms/scrivito/publish_ability.rb
scrivito_sdk-1.13.0.rc2 app/cms/scrivito/publish_ability.rb
scrivito_sdk-1.13.0.rc1 app/cms/scrivito/publish_ability.rb
scrivito_sdk-1.12.0 app/cms/scrivito/publish_ability.rb