make readonly export remotes really be readonly
When a remote is configured to be readonly, don't allow changing what's exported to it. This was missed in the original export remote implementation, but it makes sense for a readonly export remote to not be allowed to change.
This commit is contained in:
parent
4c48efeb35
commit
8960f259b8
3 changed files with 38 additions and 2 deletions
|
@ -18,6 +18,8 @@ git-annex (7.20190508) UNRELEASED; urgency=medium
|
|||
the description to "", now it will error out.
|
||||
* Android: Improve installation process when the user's login shell is not
|
||||
bash.
|
||||
* When a remote is configured to be readonly, don't allow changing
|
||||
what's exported to it.
|
||||
|
||||
-- Joey Hess <id@joeyh.name> Mon, 06 May 2019 13:52:02 -0400
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{- Adds readonly support to remotes.
|
||||
-
|
||||
- Copyright 2013, 2015 Joey Hess <id@joeyh.name>
|
||||
- Copyright 2013-2019 Joey Hess <id@joeyh.name>
|
||||
-
|
||||
- Licensed under the GNU AGPL version 3 or higher.
|
||||
-}
|
||||
|
@ -28,6 +28,17 @@ adjustReadOnly r
|
|||
{ storeKey = readonlyStoreKey
|
||||
, removeKey = readonlyRemoveKey
|
||||
, repairRepo = Nothing
|
||||
, exportActions = exportActions r
|
||||
{ storeExport = readonlyStoreExport
|
||||
, removeExport = readonlyRemoveExport
|
||||
, removeExportDirectory = Just readonlyRemoveExportDirectory
|
||||
, renameExport = readonlyRenameExport
|
||||
}
|
||||
, importActions = importActions r
|
||||
{ storeExportWithContentIdentifier = readonlyStoreExportWithContentIdentifiera
|
||||
, removeExportWithContentIdentifier = readonlyRemoveExportWithContentIdentifier
|
||||
, removeExportDirectoryWhenEmpty = Just readonlyRemoveExportDirectory
|
||||
}
|
||||
}
|
||||
| otherwise = r
|
||||
|
||||
|
@ -40,7 +51,30 @@ readonlyRemoveKey _ = readonlyFail
|
|||
readonlyStorer :: Storer
|
||||
readonlyStorer _ _ _ = readonlyFail
|
||||
|
||||
readonlyStoreExport :: FilePath -> Key -> ExportLocation -> MeterUpdate -> Annex Bool
|
||||
readonlyStoreExport _ _ _ _ = readonlyFail
|
||||
|
||||
readonlyRemoveExport :: Key -> ExportLocation -> Annex Bool
|
||||
readonlyRemoveExport _ _ = readonlyFail
|
||||
|
||||
readonlyRemoveExportDirectory :: ExportDirectory -> Annex Bool
|
||||
readonlyRemoveExportDirectory _ = readonlyFail
|
||||
|
||||
readonlyRenameExport :: Key -> ExportLocation -> ExportLocation -> Annex (Maybe Bool)
|
||||
readonlyRenameExport _ _ _ = return Nothing
|
||||
|
||||
readonlyStoreExportWithContentIdentifier :: FilePath -> Key -> ExportLocation -> [ContentIdentifier] -> MeterUpdate -> Annex (Maybe ContentIdentifier)
|
||||
readonlyStoreExportWithContentIdentifier _ _ _ _ _ = do
|
||||
readonlyWarning
|
||||
return Nothing
|
||||
|
||||
removeExportWithContentIdentifier :: Key -> ExportLocation -> [ContentIdentifier] -> Annex Bool
|
||||
removeExportWithContentIdentifier _ _ _ = readonlyFail
|
||||
|
||||
readonlyFail :: Annex Bool
|
||||
readonlyFail = do
|
||||
warning "this remote is readonly"
|
||||
readonlyWarning
|
||||
return False
|
||||
|
||||
readonlyWarning :: Annex ()
|
||||
readonylWarning = warning "this remote is readonly"
|
||||
|
|
Loading…
Reference in a new issue