services/application/applicationd: Allow set -f at anytime
device acl set -f send version="", which means that it should ignore the
current version is accept the new acls.
Change-Id: I5b18a27ea5c5e0d00c117e3cc393923db09a52c4
diff --git a/services/application/applicationd/service.go b/services/application/applicationd/service.go
index 177754c..f2ccf23 100644
--- a/services/application/applicationd/service.go
+++ b/services/application/applicationd/service.go
@@ -304,15 +304,17 @@
// setAccessList writes a Permissions into the Memstore at the provided path.
// where path is expected to have already been cleaned by naming.Join.
func setAccessList(store *fs.Memstore, path string, acl access.Permissions, version string) error {
- _, oversion, err := getAccessList(store, path)
- if verror.ErrorID(err) == verror.ErrNoExist.ID {
- oversion = version
- } else if err != nil {
- return err
- }
+ if version != "" {
+ _, oversion, err := getAccessList(store, path)
+ if verror.ErrorID(err) == verror.ErrNoExist.ID {
+ oversion = version
+ } else if err != nil {
+ return err
+ }
- if oversion != version {
- return verror.NewErrBadVersion(nil)
+ if oversion != version {
+ return verror.NewErrBadVersion(nil)
+ }
}
tname, err := store.BindTransactionRoot("").CreateTransaction(nil)