SolutionGuidance / psm

Welcome to the Medicare/Medicaid Provider Enrollment Screening Portal
http://projectpsm.org/
Other
26 stars 20 forks source link

Add database-driven per-page banner message #1071

Closed jasonaowen closed 5 years ago

jasonaowen commented 5 years ago

It is useful for us to be able to show some admin-defined text on a page; examples might be page-specific directions, upcoming server maintenance windows, or the most recent deployment date.

This implementation is, perhaps, a bit over-engineered, in that it allows setting such a message on any page in the PSM, provided you are able to figure out the servlet path of the page; the original feature request was just for the login page.

The text, if defined for a page, is shown immediately after the logo in the HTML; indeed, it was by searching for instances of the logo that I found all the places to insert it. If I had had more time, I might have first refactored how the logo and banner message templates are included.

This does not include any CSS; the banner text defined in the database is included directly, HTML and all, so per-message styles can be defined via in-line CSS. We might want to add some default CSS later, so that the enclosing banner element is able to better show plain text.

It also does not include a method for creating or editing banner messages; for now, administrators must update the database directly.

We might, also, want to add a similar banner in the footer; I had considered including an enum in the entity to specify header/footer, and made the combination (servlet_path, location) unique in the database, but that seemed like too much for the initial implementation.


To test this, I ran the following in a psql session:

psm=> insert into banner_texts(servlet_path, page_text) values ('/login', 'Test');
INSERT 0 1

Then, I navigated to the login page, and saw the "Test" text show up. The easiest way I found to determine the servlet path of a page is to start WildFly with the --debug parameter, attach the interactive debugger, and set a breakpoint in BannerInterceptor or BannerServiceBean. Another I found was /provider/dashboard/. Why does the dashboard end in a slash, while the login page does not? I don't know!


If this looks good to you, dear reviewer, please merge it! I will probably not be around to do so. Likewise, if this needs tweaking, please do so! If this is a terrible idea, go ahead and close it; I will not feel slighted.

Issue #250 Show indication of when sandbox was last updated

jasonaowen commented 5 years ago

My one question is whether there are any security concerns. Like, if someone got write access to the database they could insert an invisible Githubissues.

  • Githubissues is a development platform for aggregating issues.