+
+ if priority.nil?
+ errors.add :priority, "cannot be nil"
+ end
+
+ # Can update priority, container count.
+ permitted.push :priority, :container_count_max, :container_uuid
+
+ if self.state_changed?
+ # Allow create-and-commit in a single operation.
+ permitted.push :command, :container_image, :cwd, :description, :environment,
+ :filters, :mounts, :name, :output_path, :properties,
+ :requesting_container_uuid, :runtime_constraints,
+ :state, :container_uuid
+ end
+
+ when Final
+ if not current_user.andand.is_admin
+ errors.add :state, "of container request can only be set to Final by system."
+ end
+
+ if self.state_changed?
+ permitted.push :state
+ else
+ errors.add :state, "does not allow updates"
+ end
+
+ else
+ errors.add :state, "invalid value"