setAccess method
- AccessChange? read,
- AccessChange? write,
Sets, unsets or changes local secrets for accessing the repository or disables the given access mode.
Examples
To protect both read and write access with the same password:
val password = Password("supersecret")
repo.setAccess(read: AccessChange.Enable(password), write: AccessChange.Enable(password))
To require password only for writing:
repo.setAccess(read: AccessChange.Enable(null), write: AccessChange.Enable(password))
To competelly disable write access but leave read access as it was. Warning: this operation is currently irreversibe.
repo.setAccess(read: null, write: AccessChange.Disable)
Implementation
Future<void> setAccess({
AccessChange? read,
AccessChange? write,
}) async {
final request = RequestRepositorySetAccess(
repo: handle,
read: read,
write: write,
);
final response = await client.invoke(request);
switch (response) {
case ResponseNone(): return;
default: throw UnexpectedResponse();
}
}