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

5452 User Management Console: Manage organizations for PLR #116

Draft
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

vangeliq
Copy link
Contributor

@vangeliq vangeliq commented Mar 8, 2022

Making the database:

  • Use PostGreSQL
  • organization id stored as a string
  • organization name stored as a string

The backend's application.yaml file has a few fields that should be filled based on this database:

  • spring.datasource.url
  • spring.datasource.username
  • spring.datasource.password
  • spring.datasource.database
  • spring.datasource.organization_id (this is the column name for the organization_id)
  • spring.datasource.organization_name (this is the column name for the organization_name)

connected backend to database
simplified loadOrganizations in user detail and user search.

organization controller now takes in database name from the application.yaml file.

OrganizationsController: col names are variables, taken from application.yaml files.
organizations now load on the screen as soon as it opens. deleted button to "search" for organizations and button to download results.  Removed mentions of organization update.
@sharpedavid sharpedavid changed the base branch from master to develop March 10, 2022 00:43
fixed issue where the format that user components use to save organizations is not the same with how they use the organizations
@vangeliq vangeliq changed the base branch from develop to master March 10, 2022 01:23
removed orgupdate related code + edited formatting
@vangeliq vangeliq marked this pull request as draft March 14, 2022 17:35
Copy link
Contributor

@sharpedavid sharpedavid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Valery, just a few minor tweaks, and it's done for now. All the remaining work is out of scope.

You've done a great job on this, and I can't find anything you missed or I would have done differently. Thank you for making it concise: it's easy to understand and review.

I'm glad it's consistent with the rest of the codebase. While it's possible you copied some of our bad habits, that's preferable to making too many changes, because it's easier to fix a codebase where everything is consistent (even consistently wrong) than one where every developer is doing their own thing. That said, please let us know if you see room for improvement, as we're fairly new to Vue.js.

frontend/src/components/OrganizationSearch.vue Outdated Show resolved Hide resolved
frontend/src/components/OrganizationSearch.vue Outdated Show resolved Hide resolved
frontend/src/components/OrganizationSearch.vue Outdated Show resolved Hide resolved
public void createOrganization(@RequestBody JSONObject body) throws SQLException {
jdbcTemplate.update("insert into " + database + " ("+organization_id + ", " + organization_name + ") values (?,?)",
body.get("id"), body.get("name"));
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll mention something here, but don't bother changing it because hopefully we'll get to use AWS cloud storage for this which will use a different API anyhow.

Building SQL query strings using user-provided values is vulnerable to SQL injection attacks. You can read about the attack and prevention strategies at that link.

jdbcTemplate.update("insert into " + database + " ("+organization_id + ", " + organization_name + ") values (?,?)",
body.get("id"), body.get("name"));
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the future we'll probably add more validation logic. You've validated the org ID and name on the client-side (browser), but typically we'd also want to validate inputs on the backend and database. No change necessary for now, it's out of scope, but it's just something to keep in mind.

(e.g. Using the browser's network tools, it's possible to edit the HTTP POST request and create an organization without a name.)

Copy link
Contributor

@sharpedavid sharpedavid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Approved", but do not merge as we need to implement storage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants