mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-22 10:28:27 +00:00
Fix adding a new user and don't allow to add non-local users
The user structure must provide the correct account source now.
This commit is contained in:
@ -214,10 +214,13 @@ object OCollective {
|
||||
store.transact(RUser.findAll(collective, _.login))
|
||||
|
||||
def add(s: RUser): F[AddResult] =
|
||||
store.add(
|
||||
RUser.insert(s.copy(password = PasswordCrypt.crypt(s.password))),
|
||||
RUser.exists(s.login)
|
||||
)
|
||||
if (s.source != AccountSource.Local)
|
||||
AddResult.failure(new Exception("Only local accounts can be created!")).pure[F]
|
||||
else
|
||||
store.add(
|
||||
RUser.insert(s.copy(password = PasswordCrypt.crypt(s.password))),
|
||||
RUser.exists(s.login)
|
||||
)
|
||||
|
||||
def update(s: RUser): F[AddResult] =
|
||||
store.add(RUser.update(s), RUser.exists(s.login))
|
||||
|
Reference in New Issue
Block a user