mikras_utils 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 356975b3f96e8341dba97e96ca170a0fb181c3c8654bc874300144774094daba
|
4
|
+
data.tar.gz: 5cb71f7c6add1f89ca5025bcc9630a58474055516295e50d9ad6a2386cf6eb84
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 74ba9b96d512f831d0dd1a691d1c6892447ac21f29fe91a1f62a5cd87dfefda93d95229c16ddd063ff6bfe3ae1782ea44bda0189eedf7cf757ee7ab5825e9497
|
7
|
+
data.tar.gz: 1d5a378eddd2900ef31cfcd908bdcdd4f780eaf89a162946bdf445429ef076a8fee43e2b5b7709f3fbc2852f166f43983a4b87064f59574674f64cded967e0de
|
@@ -101,7 +101,7 @@ module MkAcl
|
|
101
101
|
case_roles = rule.roles.select { _1 == _1.upcase }
|
102
102
|
|
103
103
|
if !auth_roles.empty?
|
104
|
-
role_seq = conn.
|
104
|
+
role_seq = conn.quote_values(auth_roles)
|
105
105
|
puts %(
|
106
106
|
-- Find "#{action}" system role ACLs
|
107
107
|
_acls := array[]::integer[];
|
@@ -114,7 +114,7 @@ module MkAcl
|
|
114
114
|
end
|
115
115
|
|
116
116
|
if !case_roles.empty?
|
117
|
-
role_seq = conn.
|
117
|
+
role_seq = conn.quote_values(case_roles)
|
118
118
|
puts %(
|
119
119
|
-- Find "#{action}" case role ACLs
|
120
120
|
select _acls || array_agg(id)
|
@@ -151,8 +151,8 @@ module MkAcl
|
|
151
151
|
# Insert a attach record per parent table. This snippet handles
|
152
152
|
# multiple parents of a record but the check algorithm probably does
|
153
153
|
# not TODO
|
154
|
-
auth_role_list = conn.
|
155
|
-
case_role_list = conn.
|
154
|
+
auth_role_list = conn.quote_values table.insert.rules.map(&:auth_roles).flatten
|
155
|
+
case_role_list = conn.quote_values table.insert.rules.map(&:case_roles).flatten
|
156
156
|
for parent in table.parents
|
157
157
|
id_fields = conn.values %(select column_name from acl.links where table_name = '#{table}')
|
158
158
|
for id_field in id_fields
|
@@ -30,7 +30,7 @@ module MkAcl
|
|
30
30
|
meta.chains
|
31
31
|
where src_schema_name = '#{app_schema}'
|
32
32
|
and dst_schema_name = '#{app_schema}'
|
33
|
-
and dst_table_name in #{conn.
|
33
|
+
and dst_table_name in (#{conn.quote_values(DOMAIN_TABLES)})
|
34
34
|
)
|
35
35
|
|
36
36
|
generate_per_table_id_functions
|
data/lib/mikras_utils/version.rb
CHANGED
data/tests/final-functions.sql
CHANGED
@@ -1,8 +1,10 @@
|
|
1
1
|
|
2
|
+
drop function if exists public.current_role_ids() cascade;
|
3
|
+
drop function if exists public.current_domain_roles(integer) cascade;
|
4
|
+
|
2
5
|
-- Returns an array of role IDs for the current user (from both auth and
|
3
6
|
-- app_portal). This array is matched against the relevant ACL field in the RLS
|
4
7
|
-- policies so performance is important (TODO)
|
5
|
-
drop function if exists public.current_role_ids() cascade;
|
6
8
|
create function public.current_role_ids() returns integer[] as $$
|
7
9
|
select acl_portal.select_user_acl(public.current_user_id());
|
8
10
|
$$ language sql
|
@@ -13,7 +15,6 @@ $$ language sql
|
|
13
15
|
|
14
16
|
-- Returns an array of app_portal role names (kind) for the current user in the
|
15
17
|
-- given domain
|
16
|
-
drop function if exists public.current_domain_roles(integer) cascade;
|
17
18
|
create function public.current_domain_roles(_domain_id integer) returns text[] as $$
|
18
19
|
select coalesce(array_agg(dr.role), array[]::text[])
|
19
20
|
from acl_portal.domain_users du
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mikras_utils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Claus Rasmussen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-07
|
11
|
+
date: 2024-08-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pg_conn
|