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.12.0.rc2 app/cms/scrivito/publish_ability.rb
scrivito_sdk-1.12.0.rc1 app/cms/scrivito/publish_ability.rb
scrivito_sdk-1.11.0 app/cms/scrivito/publish_ability.rb
scrivito_sdk-1.11.0.rc1 app/cms/scrivito/publish_ability.rb
scrivito_sdk-1.10.0 app/cms/scrivito/publish_ability.rb
scrivito_sdk-1.10.0.rc5 app/cms/scrivito/publish_ability.rb
scrivito_sdk-1.10.0.rc4 app/cms/scrivito/publish_ability.rb
scrivito_sdk-1.10.0.rc3 app/cms/scrivito/publish_ability.rb
scrivito_sdk-1.10.0.rc2 lib/scrivito/publish_ability.rb
scrivito_sdk-1.10.0.rc1 lib/scrivito/publish_ability.rb
scrivito_sdk-1.9.1 lib/scrivito/publish_ability.rb
scrivito_sdk-1.9.1.rc1 lib/scrivito/publish_ability.rb
scrivito_sdk-1.9.0 lib/scrivito/publish_ability.rb
scrivito_sdk-1.9.0.rc2 lib/scrivito/publish_ability.rb
scrivito_sdk-1.9.0.rc1 lib/scrivito/publish_ability.rb
scrivito_sdk-1.8.1 lib/scrivito/publish_ability.rb
scrivito_sdk-1.8.1.rc1 lib/scrivito/publish_ability.rb
scrivito_sdk-1.8.0 lib/scrivito/publish_ability.rb
scrivito_sdk-1.8.0.rc2 lib/scrivito/publish_ability.rb
scrivito_sdk-1.8.0.rc1 lib/scrivito/publish_ability.rb