-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a9d0462
commit 3907f14
Showing
6 changed files
with
94 additions
and
117 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,41 @@ | ||
package allmulti | ||
|
||
import "github.com/micromdm/nanomdm/mdm" | ||
import ( | ||
"github.com/micromdm/nanomdm/mdm" | ||
"github.com/micromdm/nanomdm/storage" | ||
) | ||
|
||
func (ms *MultiAllStorage) HasCertHash(r *mdm.Request, hash string) (bool, error) { | ||
hasFinal, finalErr := ms.stores[0].HasCertHash(r, hash) | ||
for n, storage := range ms.stores[1:] { | ||
if _, err := storage.HasCertHash(r, hash); err != nil { | ||
ms.logger.Info("method", "HasCertHash", "storage", n+1, "err", err) | ||
continue | ||
} | ||
} | ||
ms.runAndLogOthers(func(s storage.AllStorage) error { | ||
_, err := s.HasCertHash(r, hash) | ||
return err | ||
}) | ||
return hasFinal, finalErr | ||
} | ||
|
||
func (ms *MultiAllStorage) EnrollmentHasCertHash(r *mdm.Request, hash string) (bool, error) { | ||
hasFinal, finalErr := ms.stores[0].EnrollmentHasCertHash(r, hash) | ||
for n, storage := range ms.stores[1:] { | ||
if _, err := storage.EnrollmentHasCertHash(r, hash); err != nil { | ||
ms.logger.Info("method", "EnrollmentHasCertHash", "storage", n+1, "err", err) | ||
continue | ||
} | ||
} | ||
ms.runAndLogOthers(func(s storage.AllStorage) error { | ||
_, err := s.EnrollmentHasCertHash(r, hash) | ||
return err | ||
}) | ||
return hasFinal, finalErr | ||
} | ||
|
||
func (ms *MultiAllStorage) IsCertHashAssociated(r *mdm.Request, hash string) (bool, error) { | ||
isAssocFinal, finalErr := ms.stores[0].IsCertHashAssociated(r, hash) | ||
for n, storage := range ms.stores[1:] { | ||
if _, err := storage.IsCertHashAssociated(r, hash); err != nil { | ||
ms.logger.Info("method", "IsCertHashAssociated", "storage", n+1, "err", err) | ||
continue | ||
} | ||
} | ||
ms.runAndLogOthers(func(s storage.AllStorage) error { | ||
_, err := s.IsCertHashAssociated(r, hash) | ||
return err | ||
}) | ||
return isAssocFinal, finalErr | ||
} | ||
|
||
func (ms *MultiAllStorage) AssociateCertHash(r *mdm.Request, hash string) error { | ||
finalErr := ms.stores[0].AssociateCertHash(r, hash) | ||
for n, storage := range ms.stores[1:] { | ||
if err := storage.AssociateCertHash(r, hash); err != nil { | ||
ms.logger.Info("method", "AssociateCertHash", "storage", n+1, "err", err) | ||
continue | ||
} | ||
} | ||
return finalErr | ||
err := ms.stores[0].AssociateCertHash(r, hash) | ||
ms.runAndLogOthers(func(s storage.AllStorage) error { | ||
return s.AssociateCertHash(r, hash) | ||
}) | ||
return err | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters