Closed seth-shaw-asu closed 1 year ago
As long as workbench respects the default published status as configured on the content type, I agree with Seth.
Closing, this was resolved with 411cd2d6398ce081683f47805fac0a8d6fc56748. I will update the docs to mention Workflows.
Hey @mjordan I know this is a closed issue, but we are running into the same error as Seth when we try to run normal create jobs on a site with the Workflow module installed. We're getting the Media not created, POST request to "/entity/media?_format=json" returned an HTTP status code of "403"
error message.
The WB install is running main - I found the commit where you are removing the published status as a default and I checked our files - they do not have the published status default code present.
The workflow module establishes two states, Draft and Approved that mimic unpublished and published and has the default state for new node set to Draft.
I did try to manually set the status by including the column in the CSV, but no combination of values in the "published" field make any difference - keep getting ERROR 403 and no node created. (Also tried using the field templates)
Any thoughts about other things to try?
here's the config:
task: create
host: sdfsdf
username: admin
password: asdfasdf
input_csv: https://docs.google.com/spreadsheets/d/1rO6txICQGZRqaQ81XpA7jy03X8tRTWiH05WwmD4jq0Q/edit#gid=356098167
google_sheets_gid: 356098167
output_csv: stage_test_output.csv
allow_missing_files: true
allow_adding_terms: true
strict_check: false
standalone_media_url: true
output_csv_include_input_csv: true
validate_title_length: false
http_cache_storage: sqlite
delete_tmp_upload: true
field_text_format_ids:
- field_note: restricted_html
and a snippet of the csv
id,field_pid,field_resource_type,field_model,field_member_of,parent_id,field_weight,title,field_identifier,field_local_identifier,field_type,field_genre,field_edtf_date_created,field_linked_agent,field_description_long,field_physical_description_note,field_extent,field_subject,field_geographic_subject,field_subjects_name,field_use_and_reproduction,field_archival_series,field_campus,field_repository,field_display_hints,file,url_alias,published
mtholyoke:16221,mtholyoke:16221,Still Image,Image,2394,,,"Letter from Edward Murrow to Al McCarron; London, April 26, 1945",ms0576-4-1-10-3-57600001,,text,correspondence,1945-04-26,"relators:cre:person:Murrow, Edward R., 1908-1965","In this letter, Edward R. Murrow responds to a letter from his former college classmate, Al McCarron. With regards to McCarron's dislike of changes in the San Francisco area brought about by World War II, Murrow says that McCarron should spend some time in Germany. He also mentions that he has just returned from three weeks in Germany himself, and will probably be off again soon. He says he envies McCarron's time spent in San Luis Obispo, even for three days. The letter implies a contrast between conditions in Germany and the West Coast of the United States near the end of World War II.","This letter consists of one page of paper measuring 20.83 cm x 25.91 cm, having text one side. The page has two holes punched in the left margin.",20.83 cm x 25.91 cm,"Germany -- Description and travel|World War, 1939-1945 -- Germany",San Francisco (Calif.)|San Luis Obispo (Calif.),,"For copyright information or permissions questions, see our copyright statement: https://lits.mtholyoke.edu/about-lits/service-desks/archives-special-collections/asc-policies-and-services.","Series 1: Edward R. Murrow Papers circa 1929-1968; Box 4, folder 10",Mount Holyoke College,Mount Holyoke College Archives and Special Collections,Open Seadragon,https://compass.fivecolleges.edu/islandora/object/mtholyoke:16221/datastream/OBJ/view,/islandora/object/mtholyoke:16221,Approved
mtholyoke:16222,mtholyoke:16222,Still Image,Image,2394,,,"Letter from Edward Murrow to S. K. Ratcliffe; London, May 3, 1945",ms0576-4-1-10-4-57600001,,text,correspondence,1945-05-03,"relators:cre:person:Murrow, Edward R., 1908-1965","In this letter, Edward R. Murrow says that he got a mixed reception to his broadcast about Buchenwald, but thought his story was at least believed. He also counters Ratcliffe's supposition that the mass of German people did not know what was happening at Buchenwald. He believes that many people in Weimar did know where and what Buchenwald was.","This letter consists of one page of paper measuring 20.83 cm x 25.91 cm, having text one side. The page has two holes punched in the left margin.",20.83 cm x 25.91 cm,Buchenwald (Concentration camp)|Nationalsozialistische Deutsche Arbeiter-Partei (Nazi Party),"Weimar (Thuringia, Germany)",,"For copyright information or permissions questions, see our copyright statement: https://lits.mtholyoke.edu/about-lits/service-desks/archives-special-collections/asc-policies-and-services.","Series 1: Edward R. Murrow Papers circa 1929-1968; Box 4, folder 10",Mount Holyoke College,Mount Holyoke College Archives and Special Collections,Open Seadragon,https://compass.fivecolleges.edu/islandora/object/mtholyoke:16222/datastream/OBJ/view,/islandora/object/mtholyoke:16222,Approved
mtholyoke:16223,mtholyoke:16223,Still Image,Image,2394,,,Edward R. Murrow's handwritten notes regarding Buchenwald concentration camp,ms0576-8-1-3-1-57600001,,text,,1945-04-12,"relators:cre:person:Murrow, Edward R., 1908-1965","This is a one-page sheet of handwritten notes taken by Edward Murrow when he visited the Buchenwald concentration camp in April, 1945, after it had been liberated by the Allies.",This is a single piece of paper measuring 27.18 cm x 20.83 cm and has two vertical folds separating the document into thirds. It shows strong signs of wear on the folds and edges.,27.18 cm x 20.83 cm,Buchenwald (Concentration camp)|Children|Concentration camp tattoos|Concentration camps|Dead bodies--1940-1950|Diseases|Prison physicians|Prisoners of war--Germany|Starvation,,"person:Heller, Erich, 1911-1990|person:Heller, Paul, Dr., circa 1914-2001","For copyright information or permissions questions, see our copyright statement: https://lits.mtholyoke.edu/about-lits/service-desks/archives-special-collections/asc-policies-and-services.","Series 1: Edward R. Murrow Papers circa 1929-1968; Box 8, folder 3",Mount Holyoke College,Mount Holyoke College Archives and Special Collections,Open Seadragon,https://compass.fivecolleges.edu/islandora/object/mtholyoke:16223/datastream/OBJ/view,/islandora/object/mtholyoke:16223,Approved
This error is for media ("Media not created...") not nodes. I don't know how/whether Workflows applies to media creation (if it does, this PR probably didn't account for that). Can you try adding nodes_only: true
and trying again with that same CSV row to see if that narrows down the problem.
oh right - good catch thanks. When I run it with nodes_only:true I am getting nodes created. I'll go poke at the media permissions to see if I can figure anything else out there, but I do need to create media with these nodes.
Do you have any media-specific Workflow configurations (if such a thing exists)?
No the only workflow is a simple content moderation on nodes - they come in as default "draft" and can be changed to "approved" which makes them visible. I notice when I run this set without nodes_only:true, it refuses to create the node after getting the 403 back from Drupal about the media. I guess that is normal behavior.
Thanks Mark! I'm happy to test more configurations or whatever - just let me know.
@mjordan a theory that we've been discussing is that the media objects are also subject to the content moderation and are set to a draft state as default state for media creation. Wondering if it's a similar situation to the nodes where somewhere a contradictory state is being set by default? I did look through the defaults in WorkbenchConfig.py and nothing obvious jumped out. We can see that state in the db in a table: content_moderation_state_field_data_table but no obvious way to set that for media (maybe via API?). We'll keep digging, but I thought I'd share what we'd come up w/ so far.
Yup, media are always published: https://github.com/mjordan/islandora_workbench/blob/main/workbench_utils.py#L3205
We should be able to apply @seth-shaw-asu's approach to media as well.
@dmer as you can see I've opened https://github.com/mjordan/islandora_workbench/issues/664 for this. Re-closing this issue.
We have the Drupal Core Workflows module enabled which allows us to add moderation states to our objects (e.g. Draft, Reviewed, Published). This, unfortunately, appears to locks the
status
property from being set during REST operations, as noted in the linked Drupal issue comment.Workbench automatically adds
status
to node which causes the create task to fail. For example:Removing those three lines allows the create task to complete successfully.
As noted by @rosiel on Slack,
That said, the content type configuration already allows you to set a new item as published or not by default, and there is nothing preventing a user from setting the status property value either in a column or using field templates. So, I suggest we simply remove the default status property.