mirror of
https://github.com/jackfoxy/urQL.git
synced 2024-09-11 11:55:33 +03:00
grant and revoke with ship list
This commit is contained in:
parent
7ca8f8968a
commit
a92dbb7f1b
@ -123,6 +123,8 @@
|
||||
end-or-next-command
|
||||
==
|
||||
=/ parse-ship ;~(pfix sig fed:ag)
|
||||
=/ white-ship ;~(pose ;~(sfix ;~(pfix whitespace parse-ship) whitespace) ;~(pfix whitespace parse-ship) ;~(sfix parse-ship whitespace) parse-ship)
|
||||
=/ ship-list (more com white-ship)
|
||||
=/ parse-qualified-object (cook cook-qualified-object ;~(pose ;~((glue dot) parse-ship (star sym) (star sym) (star sym)) ;~((glue dot) parse-ship (star sym) dot dot (star sym)) parse-qualified-3))
|
||||
=/ on-database ;~(plug (jester 'database') parse-face)
|
||||
=/ on-namespace
|
||||
@ -309,7 +311,7 @@
|
||||
=/ permission
|
||||
;~(pfix whitespace ;~(pose (jester 'adminread') (jester 'readonly') (jester 'readwrite')))
|
||||
=/ grantee
|
||||
;~(pose (jester 'parent') (jester 'siblings') (jester 'moons') (stag %ship parse-ship))
|
||||
;~(pose (jester 'parent') (jester 'siblings') (jester 'moons') (stag %ships ship-list))
|
||||
=/ parse-grantee
|
||||
;~(pfix whitespace ;~(pfix (jester 'to') ;~(pfix whitespace grantee)))
|
||||
=/ parse-grant ;~ plug
|
||||
@ -322,12 +324,12 @@
|
||||
=/ parsed (wonk grant-nail)
|
||||
=/ next-cursor
|
||||
(get-next-cursor [script-position +<.command-nail p.q.u.+3:q.+3:grant-nail])
|
||||
?: ?=([@ [@ @] [@ @]] [parsed]) ::"grant adminread to ~sampel-palnet on database db"
|
||||
?: ?=([@ [@ [@ %~]] [@ @]] [parsed]) ::"grant adminread to ~sampel-palnet on database db"
|
||||
%= $
|
||||
script q.q.u.+3.q:grant-nail
|
||||
script-position next-cursor
|
||||
commands
|
||||
[`command-ast`(grant:ast %grant -.parsed (limo ~[+<+.parsed]) +>.parsed) commands]
|
||||
[`command-ast`(grant:ast %grant -.parsed +<+.parsed +>.parsed) commands]
|
||||
==
|
||||
?: ?=([@ @ [@ @]] [parsed]) ::"grant adminread to parent on database db"
|
||||
%= $
|
||||
@ -336,12 +338,12 @@
|
||||
commands
|
||||
[`command-ast`(grant:ast %grant -.parsed +<.parsed +>.parsed) commands]
|
||||
==
|
||||
?: ?=([@ [@ @] [@ *]] [parsed]) ::"grant Readwrite to ~sampel-palnet on namespace db.ns"
|
||||
%= $ ::"grant adminread to ~sampel-palnet on namespace ns" (ns previously cooked)
|
||||
script q.q.u.+3.q:grant-nail ::"grant Readwrite to ~sampel-palnet on db.ns.table"
|
||||
?: ?=([@ [@ [@ *]] [@ *]] [parsed]) ::"grant Readwrite to ~zod,~bus,~nec,~sampel-palnet on namespace db.ns"
|
||||
%= $ ::"grant adminread to ~zod,~bus,~nec,~sampel-palnet on namespace ns" (ns previously cooked)
|
||||
script q.q.u.+3.q:grant-nail ::"grant Readwrite to ~zod,~bus,~nec,~sampel-palnet on db.ns.table"
|
||||
script-position next-cursor
|
||||
commands
|
||||
[`command-ast`(grant:ast %grant -.parsed (limo ~[+<+.parsed]) +>.parsed) commands]
|
||||
[`command-ast`(grant:ast %grant -.parsed +<+.parsed +>.parsed) commands]
|
||||
==
|
||||
?: ?=([@ @ [@ [@ *]]] [parsed]) ::"grant readonly to siblings on namespace db.ns"
|
||||
%= $ ::"grant readwrite to moons on namespace ns" (ns previously cooked)
|
||||
@ -355,7 +357,7 @@
|
||||
=/ revoke-permission
|
||||
;~(pfix whitespace ;~(pose (jester 'adminread') (jester 'readonly') (jester 'readwrite') (jester 'all')))
|
||||
=/ revokee
|
||||
;~(pose (jester 'parent') (jester 'siblings') (jester 'moons') (jester 'all') (stag %ship parse-ship))
|
||||
;~(pose (jester 'parent') (jester 'siblings') (jester 'moons') (jester 'all') (stag %ships ship-list))
|
||||
=/ parse-revokee
|
||||
;~(pfix whitespace ;~(pfix (jester 'from') ;~(pfix whitespace revokee)))
|
||||
=/ parse-revoke ;~ plug
|
||||
@ -368,12 +370,12 @@
|
||||
=/ parsed (wonk revoke-nail)
|
||||
=/ next-cursor
|
||||
(get-next-cursor [script-position +<.command-nail p.q.u.+3:q.+3:revoke-nail])
|
||||
?: ?=([@ [@ @] [@ @]] [parsed]) ::"revoke adminread from ~sampel-palnet on database db"
|
||||
?: ?=([@ [@ [@ %~]] [@ @]] [parsed]) ::"revoke adminread from ~sampel-palnet on database db"
|
||||
%= $
|
||||
script q.q.u.+3.q:revoke-nail
|
||||
script-position next-cursor
|
||||
commands
|
||||
[`command-ast`(revoke:ast %revoke -.parsed (limo ~[+<+.parsed]) +>.parsed) commands]
|
||||
[`command-ast`(revoke:ast %revoke -.parsed +<+.parsed +>.parsed) commands]
|
||||
==
|
||||
?: ?=([@ @ [@ @]] [parsed]) ::"revoke adminread from parent on database db"
|
||||
%= $
|
||||
@ -382,12 +384,12 @@
|
||||
commands
|
||||
[`command-ast`(revoke:ast %revoke -.parsed +<.parsed +>.parsed) commands]
|
||||
==
|
||||
?: ?=([@ [@ @] [@ *]] [parsed]) ::"revoke Readwrite from ~sampel-palnet on namespace db.ns"
|
||||
%= $ ::"revoke adminread from ~sampel-palnet on namespace ns" (ns previously cooked)
|
||||
script q.q.u.+3.q:revoke-nail ::"revoke Readwrite from ~sampel-palnet on db.ns.table"
|
||||
?: ?=([@ [@ [@ *]] [@ *]] [parsed]) ::"revoke Readwrite from ~zod,~bus,~nec,~sampel-palnet on namespace db.ns"
|
||||
%= $ ::"revoke adminread from ~zod,~bus,~nec,~sampel-palnet on namespace ns" (ns previously cooked)
|
||||
script q.q.u.+3.q:revoke-nail ::"revoke Readwrite from ~zod,~bus,~nec,~sampel-palnet on db.ns.table"
|
||||
script-position next-cursor
|
||||
commands
|
||||
[`command-ast`(revoke:ast %revoke -.parsed (limo ~[+<+.parsed]) +>.parsed) commands]
|
||||
[`command-ast`(revoke:ast %revoke -.parsed +<+.parsed +>.parsed) commands]
|
||||
==
|
||||
?: ?=([@ @ [@ [@ *]]] [parsed]) ::"revoke readonly from siblings on namespace db.ns"
|
||||
%= $ ::"revoke readwrite from moons on namespace ns" (ns previously cooked)
|
||||
|
@ -360,29 +360,53 @@
|
||||
!> ~[[%grant permission=%readwrite to=~[~sampel-palnet] grant-target=[%qualified-object ship=~ database='db2' namespace='dbo' name='table']]]
|
||||
!> (parse:parse(current-database 'db2') "Grant Readwrite to ~sampel-palnet on table")
|
||||
::
|
||||
:: parent table
|
||||
:: ship list table
|
||||
++ test-grant-11
|
||||
%+ expect-eq
|
||||
!> ~[[%grant permission=%readwrite to=~[~zod ~bus ~nec ~sampel-palnet] grant-target=[%qualified-object ship=~ database='db2' namespace='dbo' name='table']]]
|
||||
!> (parse:parse(current-database 'db2') "grant Readwrite to ~zod,~bus,~nec,~sampel-palnet on table")
|
||||
::
|
||||
:: ship list on db..table
|
||||
++ test-grant-12
|
||||
%+ expect-eq
|
||||
!> ~[[%grant permission=%adminread to=~[~zod ~bus ~nec ~sampel-palnet] grant-target=[%qualified-object ship=~ database='db' namespace='dbo' name='table']]]
|
||||
!> (parse:parse(current-database 'db2') "grant adminread to ~zod,~bus,~nec,~sampel-palnet on db..table")
|
||||
::
|
||||
:: ship list spaced, table
|
||||
++ test-grant-13
|
||||
%+ expect-eq
|
||||
!> ~[[%grant permission=%readwrite to=~[~zod ~bus ~nec ~sampel-palnet] grant-target=[%qualified-object ship=~ database='db2' namespace='dbo' name='table']]]
|
||||
!> (parse:parse(current-database 'db2') "grant Readwrite to ~zod,\0a~bus ,~nec , ~sampel-palnet on table")
|
||||
::
|
||||
:: ship list spaced, on db..table
|
||||
++ test-grant-14
|
||||
%+ expect-eq
|
||||
!> ~[[%grant permission=%adminread to=~[~zod ~bus ~nec ~sampel-palnet] grant-target=[%qualified-object ship=~ database='db' namespace='dbo' name='table']]]
|
||||
!> (parse:parse(current-database 'db2') "grant adminread to ~zod , ~bus, ~nec ,~sampel-palnet on db..table")
|
||||
::
|
||||
:: parent table
|
||||
++ test-grant-15
|
||||
%+ expect-eq
|
||||
!> ~[[%grant permission=%adminread to=%parent grant-target=[%qualified-object ship=~ database='db2' namespace='dbo' name='table']]]
|
||||
!> (parse:parse(current-database 'db2') "grant adminread to parent on table")
|
||||
::
|
||||
:: fail when database qualifier is not a term
|
||||
++ test-grant-12
|
||||
++ test-grant-16
|
||||
%- expect-fail
|
||||
|. (parse:parse(current-database 'db2') "grant adminread to parent on Db.ns.table")
|
||||
::
|
||||
:: fail when namespace qualifier is not a term
|
||||
++ test-grant-13
|
||||
++ test-grant-17
|
||||
%- expect-fail
|
||||
|. (parse:parse(current-database 'db2') "grant adminread to parent on db.Ns.table")
|
||||
::
|
||||
:: fail when table name is not a term
|
||||
++ test-grant-14
|
||||
++ test-grant-18
|
||||
%- expect-fail
|
||||
|. (parse:parse(current-database 'other-db') "grant adminread to parent on Table")
|
||||
::
|
||||
:: fail when table name is qualified with ship
|
||||
++ test-grant-15
|
||||
++ test-grant-19
|
||||
%- expect-fail
|
||||
|. (parse:parse(current-database 'other-db') "grant adminread to parent ~zod.db.ns.name")
|
||||
::
|
||||
@ -426,11 +450,11 @@
|
||||
!> ~[[%revoke permission=%readwrite to=~[~sampel-palnet] revoke-target=[%qualified-object ship=~ database='db' namespace='ns' name='table']]]
|
||||
!> (parse:parse(current-database 'db2') "Revoke Readwrite from ~sampel-palnet on db.ns.table")
|
||||
::
|
||||
:: parent db.ns.table
|
||||
:: all from all db.ns.table
|
||||
++ test-revoke-7
|
||||
%+ expect-eq
|
||||
!> ~[[%revoke permission=%adminread from=%parent revoke-target=[%qualified-object ship=~ database='db' namespace='ns' name='table']]]
|
||||
!> (parse:parse(current-database 'db2') "revoke adminread from parent on db.ns.table")
|
||||
!> ~[[%revoke permission=%all from=%all revoke-target=[%qualified-object ship=~ database='db' namespace='ns' name='table']]]
|
||||
!> (parse:parse(current-database 'db2') "revoke all from all on db.ns.table")
|
||||
::
|
||||
:: ship db..table
|
||||
++ test-revoke-8
|
||||
@ -444,35 +468,59 @@
|
||||
!> ~[[%revoke permission=%adminread from=%parent revoke-target=[%qualified-object ship=~ database='db' namespace='dbo' name='table']]]
|
||||
!> (parse:parse(current-database 'db2') "revoke adminread from parent on db..table")
|
||||
::
|
||||
:: ship table
|
||||
:: single ship table
|
||||
++ test-revoke-10
|
||||
%+ expect-eq
|
||||
!> ~[[%revoke permission=%readwrite from=~[~sampel-palnet] revoke-target=[%qualified-object ship=~ database='db2' namespace='dbo' name='table']]]
|
||||
!> (parse:parse(current-database 'db2') "Revoke Readwrite from ~sampel-palnet on table")
|
||||
::
|
||||
:: parent table
|
||||
:: ship list table
|
||||
++ test-revoke-11
|
||||
%+ expect-eq
|
||||
!> ~[[%revoke permission=%readwrite from=~[~zod ~sampel-palnet-sampel-palnet ~nec ~sampel-palnet] revoke-target=[%qualified-object ship=~ database='db2' namespace='dbo' name='table']]]
|
||||
!> (parse:parse(current-database 'db2') "Revoke Readwrite from ~zod,~sampel-palnet-sampel-palnet,~nec,~sampel-palnet on table")
|
||||
::
|
||||
:: ship list on db..table
|
||||
++ test-revoke-12
|
||||
%+ expect-eq
|
||||
!> ~[[%revoke permission=%adminread from=~[~zod ~bus ~nec ~sampel-palnet] revoke-target=[%qualified-object ship=~ database='db' namespace='dbo' name='table']]]
|
||||
!> (parse:parse(current-database 'db2') "revoke adminread from ~zod,~bus,~nec,~sampel-palnet on db..table")
|
||||
::
|
||||
:: ship list spaced, table
|
||||
++ test-revoke-13
|
||||
%+ expect-eq
|
||||
!> ~[[%revoke permission=%readwrite from=~[~zod ~bus ~nec ~sampel-palnet] revoke-target=[%qualified-object ship=~ database='db2' namespace='dbo' name='table']]]
|
||||
!> (parse:parse(current-database 'db2') "Revoke Readwrite from ~zod,\0a~bus ,~nec , ~sampel-palnet on table")
|
||||
::
|
||||
:: ship list spaced, on db..table
|
||||
++ test-revoke-14
|
||||
%+ expect-eq
|
||||
!> ~[[%revoke permission=%adminread from=~[~zod ~bus ~nec ~sampel-palnet] revoke-target=[%qualified-object ship=~ database='db' namespace='dbo' name='table']]]
|
||||
!> (parse:parse(current-database 'db2') "revoke adminread from ~zod , ~bus, ~nec ,~sampel-palnet on db..table")
|
||||
::
|
||||
:: parent table
|
||||
++ test-revoke-15
|
||||
%+ expect-eq
|
||||
!> ~[[%revoke permission=%adminread from=%parent revoke-target=[%qualified-object ship=~ database='db2' namespace='dbo' name='table']]]
|
||||
!> (parse:parse(current-database 'db2') "revoke adminread from parent on table")
|
||||
::
|
||||
:: fail when database qualifier is not a term
|
||||
++ test-revoke-12
|
||||
++ test-revoke-16
|
||||
%- expect-fail
|
||||
|. (parse:parse(current-database 'db2') "revoke adminread from parent on Db.ns.table")
|
||||
::
|
||||
:: fail when namespace qualifier is not a term
|
||||
++ test-revoke-13
|
||||
++ test-revoke-17
|
||||
%- expect-fail
|
||||
|. (parse:parse(current-database 'db2') "revoke adminread from parent on db.Ns.table")
|
||||
::
|
||||
:: fail when table name is not a term
|
||||
++ test-revoke-14
|
||||
++ test-revoke-18
|
||||
%- expect-fail
|
||||
|. (parse:parse(current-database 'other-db') "revoke adminread from parent on Table")
|
||||
::
|
||||
:: fail when table name is qualified with ship
|
||||
++ test-revoke-15
|
||||
++ test-revoke-19
|
||||
%- expect-fail
|
||||
|. (parse:parse(current-database 'other-db') "revoke adminread from parent on ~zod.db.ns.name")
|
||||
::
|
||||
|
Loading…
Reference in New Issue
Block a user