Merge pull request #4503 from wy65701436/add-readonly-sysinfo

Add readonly into systeminfo
This commit is contained in:
Daniel Jiang 2018-03-28 13:00:32 +08:00 committed by GitHub
commit 5c1314d286
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 0 deletions

View File

@ -99,6 +99,7 @@ type GeneralInfo struct {
NextScanAll int64 `json:"next_scan_all"`
ClairVulnStatus *models.ClairVulnerabilityStatus `json:"clair_vulnerability_status,omitempty"`
RegistryStorageProviderName string `json:"registry_storage_provider_name"`
ReadOnly bool `json:"read_only"`
}
// validate for validating user if an admin.
@ -177,6 +178,7 @@ func (sia *SystemInfoAPI) GetGeneralInfo() {
HasCARoot: caStatErr == nil,
HarborVersion: harborVersion,
RegistryStorageProviderName: cfg[common.RegistryStorageProviderName].(string),
ReadOnly: config.ReadOnly(),
}
if info.WithClair {
info.ClairVulnStatus = getClairVulnStatus()

View File

@ -64,6 +64,7 @@ func TestGetGeneralInfo(t *testing.T) {
assert.Equal(false, g.WithNotary, "with notary should be false")
assert.Equal(true, g.HasCARoot, "has ca root should be true")
assert.NotEmpty(g.HarborVersion, "harbor version should not be empty")
assert.Equal(false, g.ReadOnly, "readonly should be false")
}
func TestGetCert(t *testing.T) {