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

User Object ACL Extension #1537

Open
dbauszus-glx opened this issue Oct 7, 2024 · 0 comments
Open

User Object ACL Extension #1537

dbauszus-glx opened this issue Oct 7, 2024 · 0 comments
Labels
Feature New feature requests or changes to the behaviour or look of existing application features. RFC Request for Comment or Change. Security Ticket relates to either the authentication process, security headers, and or encryption.
Milestone

Comments

@dbauszus-glx
Copy link
Member

dbauszus-glx commented Oct 7, 2024

Database Schema

Table Structure

CREATE TABLE
  test.acl (
    _id serial NOT NULL,
    email text NOT NULL,
    password text NULL,
    verified boolean NULL DEFAULT false,
    approved boolean NULL DEFAULT false,
    verificationtoken text NULL,
    approvaltoken text NULL,
    failedattempts integer NULL DEFAULT 0,
    password_reset text NULL,
    api text NULL,
    approved_by text NULL,
    access_log text[] NULL DEFAULT '{}'::text[],
    blocked boolean NULL DEFAULT false,
    roles text[] NULL DEFAULT '{}'::text[],
    admin boolean NULL DEFAULT false,
    language text NULL DEFAULT 'en'::text,
    session text NULL,
    expires_on bigint NULL,

    locale_object JSONB, --new locale object storage field
  );
  1. Write Operations
-- Insert new record
INSERT INTO acl (_id, roles, admin, local_object)
VALUES ($1, $2, $3, $4);

-- Update specific field
UPDATE user_acl 
SET locale_object = jsonb_set(locale_object, $2, $3::jsonb)
WHERE _id = $1;

-- Delete field
UPDATE user_acl 
SET locale_object = locale_object - $2,
    updated_at = NOW()
WHERE _id = $1;

Performance Considerations

JSONB vs JSON

  • Using JSONB for better query performance
  • Enables GIN indexing for complex queries
  • Binary storage format reduces storage size
@dbauszus-glx dbauszus-glx added Feature New feature requests or changes to the behaviour or look of existing application features. Security Ticket relates to either the authentication process, security headers, and or encryption. RFC Request for Comment or Change. labels Oct 7, 2024
@RobAndrewHurst RobAndrewHurst added this to the User Locale milestone Oct 29, 2024
@RobAndrewHurst RobAndrewHurst changed the title User object in ACL User Object ACL Extension Nov 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature New feature requests or changes to the behaviour or look of existing application features. RFC Request for Comment or Change. Security Ticket relates to either the authentication process, security headers, and or encryption.
Projects
None yet
Development

No branches or pull requests

2 participants