Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
belenios
belenios
Commits
ba2189cd
Commit
ba2189cd
authored
Apr 03, 2014
by
Stephane Glondu
Browse files
Use string_set in acl
parent
47a232fe
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/web/web_common.ml
View file @
ba2189cd
...
...
@@ -22,6 +22,7 @@
open
Lwt
open
Signatures
open
Common
open
Serializable_builtin_t
open
Serializable_builtin_j
open
Serializable_t
open
Web_serializable_t
...
...
@@ -159,8 +160,11 @@ let check_acl a u =
|
Some
(
`Many
items
)
->
let
rec
loop
=
function
|
[]
->
false
|
`Domain
x
::
_
when
x
=
u
.
user_domain
->
true
|
`User
x
::
_
when
x
=
u
->
true
|
item
::
_
when
item
.
acl_domain
=
u
.
user_domain
->
(
match
item
.
acl_users
with
|
`Any
->
true
|
`Many
users
->
SSet
.
mem
u
.
user_name
users
)
|
_
::
xs
->
loop
xs
in
loop
items
|
_
->
false
...
...
src/web/web_serializable.atd
View file @
ba2189cd
...
...
@@ -25,6 +25,7 @@
type uuid <ocaml predef from="Serializable_builtin"> = abstract
type datetime <ocaml predef from="Serializable_builtin"> = abstract
type string_set <ocaml predef from="Serializable_builtin"> = abstract
(** {1 Web-specific types} *)
...
...
@@ -38,11 +39,16 @@ type user = {
name : string;
} <ocaml field_prefix="user_">
type
acl_item
=
[
Domain of string
|
User of u
se
r
type
names
=
[
Any
|
Many of string_
se
t
]
type acl_item = {
domain : string;
users : names;
} <ocaml field_prefix="acl_">
type acl =
[ Any
| Many of acl_item list
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment