lib/scrivito/user.rb in scrivito_sdk-0.30.0 vs lib/scrivito/user.rb in scrivito_sdk-0.40.0.rc1

- old
+ new

@@ -142,10 +142,12 @@ # # @api public # @param [BasicObj] obj the obj that should be published # @return [Array<String>] Hints why the user can't publish def restriction_messages_for(obj) + assert_restrictions_applicable(obj) + return [] if can_always?(:publish, :workspace) if obj.modification == Modification::EDITED base_revision_obj = obj.in_revision(obj.revision.workspace.base_revision) @@ -181,9 +183,15 @@ description_proc ? description_proc.call : id end def assert_valid_verb(verb) raise ScrivitoError.new("Invalid verb '#{verb}'") unless VERBS.include?(verb) + end + + def assert_restrictions_applicable(obj) + if obj.revision.base? + raise ScrivitoError.new("The revision of #{obj.inspect} may not be a base revision") + end end def sandbox_suggest_user_proc(input) suggest_users_proc.call(input) rescue Exception => e