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

rpc/primary_keys and rpc/foreign_keys response #2

Closed
gonzalomelov opened this issue Feb 16, 2019 · 2 comments
Closed

rpc/primary_keys and rpc/foreign_keys response #2

gonzalomelov opened this issue Feb 16, 2019 · 2 comments

Comments

@gonzalomelov
Copy link

I'm not able to set the create/edit mode for my database tables. Is there any documentation in order to understand the configuration or responses that have to be made in these methods?

@priyank-purohit
Copy link
Owner

priyank-purohit commented Feb 19, 2019

Hey, sorry the documentation is still in progress (progress is pretty much halted right now due to work). But give me until tomorrow evening, I'll reply here with the information you need.

But basically, it's a psql function, and a setting in the config.json file before the feature can work correctly. Also, of course, you'd need to configure HTTPS and what not to ensure basic security.

@priyank-purohit
Copy link
Owner

priyank-purohit commented Mar 3, 2019

To be able to edit a table: the table must have primary key defined + a primary key function also must exist in the database + the user must also have edit privileges.

  1. /data/config.json should have the following settings to indicate the db has the primary_keys() function:
{
    databases: [
        url: "https://...",
        "primaryKeyFunction": true,
        "foreignKeySearch": true
}
  1. Execute the 4 SQL scripts available in the repository at /scripts. They are:
  • Authentication.sql (change the secret on line 104, and the credentials on lines 115-117) (Creates the auth framework using the db to validate credentials)
  • CREATE FUNCTION.sql (has the primary_keys() function which allows the front-end to uniquely identify one row to edit it) (foreign_keys() function is optional for the search box)
  • CREATE_ROLE.sql (change database and table names as necessary) (grants privileges to read and edit users)
  • CREATE TABLE change_log.sql (to keep track of edits made to the database)
  1. Then you can login using the edituser credentials defined in Authentication.sql file.

I could've used a commercial paid/free auth services but I wanted the PostgreSQL db to contain everything needed to share data including all authentication services. Apologies for the late response.

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

No branches or pull requests

2 participants