mirror of
https://gitlab.com/fabinfra/fabaccess/fabaccess-api.git
synced 2025-03-13 23:31:43 +01:00
Make Users::addUser fail in a better way
This commit is contained in:
parent
a3b02d8102
commit
b12fa851c5
24
users.capnp
24
users.capnp
@ -8,7 +8,29 @@ using import "user.capnp".User;
|
|||||||
interface Users {
|
interface Users {
|
||||||
list @0 () -> ( users :List(User) );
|
list @0 () -> ( users :List(User) );
|
||||||
|
|
||||||
addUser @1 ( username :Text, password :Text ) -> ( user :User );
|
addUser @1 ( username :Text, password :Text ) -> ( user :User, error :Error );
|
||||||
|
# Add a new user. If adding the user succeeds then the newly created user is returned and
|
||||||
|
# `error` is NULL / set to Error::ok. If adding the user fails `user` is NULL and `error`
|
||||||
|
# contains the reason for the failure.
|
||||||
|
|
||||||
removeUser @2 ( user :User );
|
removeUser @2 ( user :User );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct Error {
|
||||||
|
union {
|
||||||
|
ok @0 :Void;
|
||||||
|
# This error is not actually set, i.e. the operation completed successfully.
|
||||||
|
# This field is necessary because a NULL struct pointer may be interpreted as a struct with
|
||||||
|
# default values. In that case this will appear as an `Error` with the `ok` field set.
|
||||||
|
|
||||||
|
exists @1 :Void;
|
||||||
|
# There is already an user with the requested username
|
||||||
|
|
||||||
|
usernameInvalid @2 :Void;
|
||||||
|
# The provided username is not usable, e.g. contains invalid characters, is too long, or too
|
||||||
|
# short.
|
||||||
|
|
||||||
|
passwordInvalid @3 :Void;
|
||||||
|
# The provided password is not usable, e.g. it's zero-length.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user