Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patches and Enhancements #1951

Merged
merged 53 commits into from
Sep 25, 2024
Merged

Patches and Enhancements #1951

merged 53 commits into from
Sep 25, 2024

Conversation

wwelling
Copy link
Collaborator

@wwelling wwelling commented Aug 1, 2024

Feature modifications:

  • Fixes admin submission view submission status last action
  • Adds Student Name, full name, submission list column
  • Fixes last event and event time submission list columns not rendering data
  • Adds additional Graduation Semester (List) further filter by
  • Optionally use netid as user unique identifier for SSO
  • Fixes shibboleth mappings applying to user creation/update from SSO

Database schema changes:

  • netid on user becomes unique
ALTER TABLE weaver_users ADD UNIQUE (netid);
  • submission one to one column join with action log
ALTER TABLE submission
  ADD COLUMN last_action_id bigint;

ALTER TABLE action_log
  ADD COLUMN action_logs_id bigint;

ALTER TABLE ONLY submission
    ADD CONSTRAINT fk2c4y6bgj1x6np516kh15ou9x0 FOREIGN KEY (last_action_id) REFERENCES action_log(id);
    
ALTER TABLE ONLY action_log
    ADD CONSTRAINT fksts0pd42l0bhqek84ph9ry1i7 FOREIGN KEY (action_logs_id) REFERENCES submission(id);
  • submission list column unique constraint becomes only by title and not title, predicate, and input type
DO $$
DECLARE
    v_constraint_name TEXT;
BEGIN
    WITH constraint_info AS (
        SELECT
            conname AS constraint_name,
            conrelid::regclass AS table_name,
            ARRAY(SELECT a.attname
                  FROM unnest(conkey) AS k
                  JOIN pg_attribute AS a ON a.attnum = k AND a.attrelid = conrelid) AS column_names
        FROM
            pg_constraint
        WHERE
            conrelid = 'submission_list_column'::regclass
    ),
    constraints AS (
        SELECT
            ci.constraint_name,
            ci.table_name
        FROM
            constraint_info ci
        WHERE
            ci.column_names::text[] @> ARRAY['title', 'predicate', 'input_type_id']::text[]
    )
    SELECT constraint_name INTO v_constraint_name FROM constraints;

    IF v_constraint_name IS NOT NULL THEN
        EXECUTE format('ALTER TABLE %I DROP CONSTRAINT %I', 'submission_list_column', v_constraint_name);
    END IF;

    EXECUTE format('ALTER TABLE %I ADD CONSTRAINT %I UNIQUE (%I)', 'submission_list_column', v_constraint_name, 'title');
END $$;

Default initialized data changes:

  • submission last action join update
WITH submissions AS (
  SELECT * 
  FROM submission 
  WHERE last_action_id IS NULL
),
last_action_logs AS (
  SELECT DISTINCT ON (s.id) al.id AS aid, s.id AS sid 
  FROM action_log al
  JOIN submissions s ON al.action_logs_id = s.id
  ORDER BY s.id, al.action_date DESC
)
UPDATE submission s
SET last_action_id = las.aid
FROM last_action_logs las
WHERE s.id = las.sid;
  • update the submission list columns last action value path double check ids to be updating Event Time
UPDATE submission_list_column SET input_type_id = 8 WHERE id = 57;
UPDATE submission_list_column_value_path SET value_path = 'lastAction' WHERE submission_list_column_id = 56;
INSERT INTO submission_list_column_value_path (submission_list_column_id, value_path, value_path_order) VALUES (56, 'entry', 1), (57, 'lastAction', 0), (57, 'actionDate', 1);
  • submission list column for student name
INSERT INTO submission_list_column (predicate, status, title, input_type_id) VALUES ('last_name, first_name middle_name', NULL, 'Student Name', 1);

WITH submission AS (
    SELECT id
    FROM submission_list_column
    WHERE predicate = 'last_name, first_name middle_name'
)
INSERT INTO submission_list_column_value_path (submission_list_column_id, value_path, value_path_order)
SELECT id, 'fieldValues', 0 FROM submission UNION ALL SELECT id, 'value', 1 FROM submission;
  • submission list column for graduation semester further filter by list
INSERT INTO submission_list_column (predicate, status, title, input_type_id) VALUES ('dc.date.issued', NULL, 'Graduation Semester (List)', 7);

WITH submission AS (
    SELECT id
    FROM submission_list_column
    WHERE title = 'Graduation Semester (List)'
)
INSERT INTO submission_list_column_value_path (submission_list_column_id, value_path, value_path_order)
SELECT id, 'fieldValues', 0 FROM submission UNION ALL SELECT id, 'value', 1 FROM submission;
  • shibboleth managed configuration updates
UPDATE managed_configuration SET name = 'auth.shib.enabled' WHERE name = 'APPLICATION_AUTH_SHIB_ENABLED';
UPDATE managed_configuration SET name = 'auth.shib.visible' WHERE name = 'APPLICATION_AUTH_SHIB_VISIBLE';
UPDATE managed_configuration SET name = 'auth.shib.name' WHERE name = 'APPLICATION_AUTH_SHIB_NAME';
UPDATE managed_configuration SET name = 'auth.shib.description' WHERE name = 'APPLICATION_AUTH_SHIB_DESCRIPTION';
UPDATE managed_configuration SET name = 'auth.shib.login.forceSSL' WHERE name = 'APPLICATION_AUTH_SHIB_LOGIN_FORCE_SSL';
UPDATE managed_configuration SET name = 'auth.shib.login.url' WHERE name = 'APPLICATION_AUTH_SHIB_LOGIN_URL';
UPDATE managed_configuration SET name = 'auth.shib.logout.url' WHERE name = 'APPLICATION_AUTH_SHIB_LOGOUT_URL';
UPDATE managed_configuration SET name = 'auth.shib.logout.enabled' WHERE name = 'APPLICATION_AUTH_SHIB_LOGOUT_ENABLED';
UPDATE managed_configuration SET name = 'auth.shib.primaryIdentifier' WHERE name = 'APPLICATION_AUTH_SHIB_PRIMARY_IDENTIFIER';
UPDATE managed_configuration SET name = 'auth.shib.mock' WHERE name = 'APPLICATION_AUTH_SHIB_MOCK';
UPDATE managed_configuration SET name = 'auth.shib.log' WHERE name = 'APPLICATION_AUTH_SHIB_LOG';
UPDATE managed_configuration SET name = 'auth.shib.attribute.netid' WHERE name = 'APPLICATION_AUTH_SHIB_ATTRIBUTE_NETID';
UPDATE managed_configuration SET name = 'auth.shib.attribute.email' WHERE name = 'APPLICATION_AUTH_SHIB_ATTRIBUTE_EMAIL';
UPDATE managed_configuration SET name = 'auth.shib.attribute.firstName' WHERE name = 'APPLICATION_AUTH_SHIB_ATTRIBUTE_FIRST_NAME';
UPDATE managed_configuration SET name = 'auth.shib.attribute.lastName' WHERE name = 'APPLICATION_AUTH_SHIB_ATTRIBUTE_LAST_NAME';
UPDATE managed_configuration SET name = 'auth.shib.attribute.institutionIdentifier' WHERE name = 'APPLICATION_AUTH_SHIB_ATTRIBUTE_INSTITUTION_IDENTIFIER';
UPDATE managed_configuration SET name = 'auth.shib.attribute.institutionalIdentifier' WHERE name = 'APPLICATION_AUTH_SHIB_ATTRIBUTE_INSTITUTIONAL_IDENTIFIER';
UPDATE managed_configuration SET name = 'auth.shib.attribute.middleName' WHERE name = 'APPLICATION_AUTH_SHIB_ATTRIBUTE_MIDDLE_NAME';
UPDATE managed_configuration SET name = 'auth.shib.attribute.birthYear' WHERE name = 'APPLICATION_AUTH_SHIB_ATTRIBUTE_BIRTH_YEAR';
UPDATE managed_configuration SET name = 'auth.shib.attribute.affiliations' WHERE name = 'APPLICATION_AUTH_SHIB_ATTRIBUTE_AFFILIATIONS';
UPDATE managed_configuration SET name = 'auth.shib.attribute.currentPhoneNumber' WHERE name = 'APPLICATION_AUTH_SHIB_ATTRIBUTE_CURRENT_PHONE_NUMBER';
UPDATE managed_configuration SET name = 'auth.shib.attribute.currentPostalAddress' WHERE name = 'APPLICATION_AUTH_SHIB_ATTRIBUTE_CURRENT_POSTAL_ADDRESS';
UPDATE managed_configuration SET name = 'auth.shib.attribute.currentEmailAddress' WHERE name = 'APPLICATION_AUTH_SHIB_ATTRIBUTE_CURRENT_EMAIL_ADDRESS';
UPDATE managed_configuration SET name = 'auth.shib.attribute.permanentPhoneNumber' WHERE name = 'APPLICATION_AUTH_SHIB_ATTRIBUTE_PERMANENT_PHONE_NUMBER';
UPDATE managed_configuration SET name = 'auth.shib.attribute.permanentPostalAddress' WHERE name = 'APPLICATION_AUTH_SHIB_ATTRIBUTE_PERMANENT_POSTAL_ADDRESS';
UPDATE managed_configuration SET name = 'auth.shib.attribute.permanentEmailAddress' WHERE name = 'APPLICATION_AUTH_SHIB_ATTRIBUTE_PERMANENT_EMAIL_ADDRESS';
UPDATE managed_configuration SET name = 'auth.shib.attribute.currentDegree' WHERE name = 'APPLICATION_AUTH_SHIB_ATTRIBUTE_CURRENT_DEGREE';
UPDATE managed_configuration SET name = 'auth.shib.attribute.currentDepartment' WHERE name = 'APPLICATION_AUTH_SHIB_ATTRIBUTE_CURRENT_DEPARTMENT';
UPDATE managed_configuration SET name = 'auth.shib.attribute.currentCollege' WHERE name = 'APPLICATION_AUTH_SHIB_ATTRIBUTE_CURRENT_COLLEGE';
UPDATE managed_configuration SET name = 'auth.shib.attribute.currentMajor' WHERE name = 'APPLICATION_AUTH_SHIB_ATTRIBUTE_CURRENT_MAJOR';
UPDATE managed_configuration SET name = 'auth.shib.attribute.currentGraduationYear' WHERE name = 'APPLICATION_AUTH_SHIB_ATTRIBUTE_CURRENT_GRADUATION_YEAR';
UPDATE managed_configuration SET name = 'auth.shib.attribute.currentGraduationMonth' WHERE name = 'APPLICATION_AUTH_SHIB_ATTRIBUTE_CURRENT_GRADUATION_MONTH';
UPDATE managed_configuration SET name = 'auth.shib.attribute.orcid' WHERE name = 'APPLICATION_AUTH_SHIB_ATTRIBUTE_ORCID';

kaladay and others added 30 commits July 12, 2024 09:40
The error:
```
[ERROR] Tests run: 5, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0 s <<< FAILURE! - in org.tdl.vireo.model.EmailRecipientContactTest
[ERROR] testGetEmails  Time elapsed: 0 s  <<< FAILURE!
org.opentest4j.AssertionFailedError: Emails array does not have the correct length. ==> expected: <0> but was: <2>
	at org.tdl.vireo.model.EmailRecipientContactTest.testGetEmails(EmailRecipientContactTest.java:50)
```

This PR and commit:
- TexasDigitalLibrary#1923
- TexasDigitalLibrary@7b4a7b8

Did not also update the unit test.

This updates the unit test to now mock `getFieldValuesByPredicateValue()` instead of mocking `getFieldValuesByPredicate()`.
…ntContactTest

Fix Test failure regarding EmailRecipientContactTest file.
Submission list column title and predicate are derived without referential integrity from organization workflow field profile gloss and field profile field predicate value.
Co-Authored-By: Q'Sean <134101252+qtamu@users.noreply.github.com>
Co-Authored-By: Q'Sean <134101252+qtamu@users.noreply.github.com>
Co-Authored-By: Q'Sean <134101252+qtamu@users.noreply.github.com>
…oleth-mapping

Update shibboleth mapping configurations
@wwelling wwelling marked this pull request as ready for review August 1, 2024 16:25
@wwelling wwelling changed the title 4.2.8 Snapshot Patches and Enhancements Patches and Enhancements Aug 1, 2024
@smutniak
Copy link
Contributor

I'm deploying a test site for UNT. I start with an 'out of the box' data model from this branch and then do a migration as well as a few sql commands such as the one to populate last action on submission, and the sql to update managed_configuration values to their lower case counterpart.

When I create a filter for either Graduation Semester or Graduation Semester (List)

I see the filters build up in the named_search_filter, named_search_filter_filter_criteria, and filter_criterion.
I do not see them get deleted from the database tables but I do not see them listed in the Remove Existing Filters.

multiple filter tries sometimes yields odd results such as the selected MM YYYY graduation semester not displaying under the 'Now FIltering By:' also, sometimes I see a value display problem where all the values in the list view look like:

{{displaySubmissionProperty(row,col)}}

Frank

@wwelling
Copy link
Collaborator Author

@smutniak thanks for testing this PR. I will look into the accumulating named_search_filter, named_search_filter_filter_criteria, and filter_criterion. This seems like the difference between public and private filters and may be logic which leaves public filters in place. Not sure off hand though. As for the odd results, are there any console errors that could provide some hints?

@smutniak
Copy link
Contributor

I don't recall the console errors but sometimes the {{displaySubmissionProperty(row,col)}} result could be just in 1 row/page.

@smutniak
Copy link
Contributor

I worked out the SQL upgrade for our sites and tested. One site had problems but this appears to be a matter of that site's data.

smutniak
smutniak previously approved these changes Sep 23, 2024
@cstarcher cstarcher merged commit ec609fd into TexasDigitalLibrary:main Sep 25, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants