ch logika
This commit is contained in:
1 parent
e0d03730de
commit
d3e188affe
28 files changed
+405
-656
No files matched your search
@@ -77,22 +77,6 @@ CREATE TABLE IF NOT EXISTS permission_role (
|
||||
CONSTRAINT permission_role_permission_id_role_id_key UNIQUE (permission_id, role_id)
|
||||
);
|
||||
|
||||
-- Per-user permission override on top of the role's baseline: 'allow' grants
|
||||
-- a permission the user's role does not have, 'deny' revokes one the role
|
||||
-- does grant. An admin can flip their mind by re-assigning the same
|
||||
-- permission/user pair with a different effect (upsert), rather than having
|
||||
-- to delete the old override first.
|
||||
CREATE TABLE IF NOT EXISTS permission_user (
|
||||
id bigserial PRIMARY KEY,
|
||||
permission_id bigint REFERENCES permissions(id),
|
||||
user_id bigint REFERENCES users(id),
|
||||
effect character varying(10) NOT NULL DEFAULT 'allow',
|
||||
created_at TIMESTAMP DEFAULT (CURRENT_TIMESTAMP AT TIME ZONE 'UTC') NOT NULL,
|
||||
updated_at TIMESTAMP DEFAULT (CURRENT_TIMESTAMP AT TIME ZONE 'UTC') NOT NULL,
|
||||
CONSTRAINT permission_user_permission_id_user_id_key UNIQUE (permission_id, user_id),
|
||||
CONSTRAINT permission_user_effect_chk CHECK (effect IN ('allow', 'deny'))
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS provinces (
|
||||
id bigserial PRIMARY KEY,
|
||||
name json NOT NULL DEFAULT '{}'::json,
|
||||
@@ -349,7 +333,7 @@ CREATE TABLE IF NOT EXISTS loans (
|
||||
CREATE TABLE IF NOT EXISTS loan_paid_off_letters (
|
||||
id bigserial PRIMARY KEY,
|
||||
unique_id character varying(255),
|
||||
region character varying(2) NOT NULL,
|
||||
region character varying(255) NOT NULL,
|
||||
branch_id bigint NOT NULL,
|
||||
user_id bigint,
|
||||
customer_name character varying(255) NOT NULL,
|
||||
@@ -525,7 +509,6 @@ CREATE TABLE IF NOT EXISTS currencies (
|
||||
-- table scan.
|
||||
CREATE INDEX IF NOT EXISTS idx_role_user_user_id ON role_user(user_id);
|
||||
CREATE INDEX IF NOT EXISTS idx_permission_role_role_id ON permission_role(role_id);
|
||||
CREATE INDEX IF NOT EXISTS idx_permission_user_user_id ON permission_user(user_id);
|
||||
CREATE INDEX IF NOT EXISTS idx_roles_code ON roles(code);
|
||||
CREATE INDEX IF NOT EXISTS idx_permissions_code ON permissions(code);
|
||||
CREATE INDEX IF NOT EXISTS idx_permissions_module ON permissions(module);
|
||||
|
||||
Reference in new issue
Block a user