Add readonly into systeminfo

This commit is contained in:
wangyan 2018-03-27 04:15:33 -07:00
parent 14e24267c0
commit 01487b8221
2 changed files with 3 additions and 0 deletions

View File

@ -99,6 +99,7 @@ type GeneralInfo struct {
NextScanAll int64 `json:"next_scan_all"` NextScanAll int64 `json:"next_scan_all"`
ClairVulnStatus *models.ClairVulnerabilityStatus `json:"clair_vulnerability_status,omitempty"` ClairVulnStatus *models.ClairVulnerabilityStatus `json:"clair_vulnerability_status,omitempty"`
RegistryStorageProviderName string `json:"registry_storage_provider_name"` RegistryStorageProviderName string `json:"registry_storage_provider_name"`
ReadOnly bool `json:"read_only"`
} }
// validate for validating user if an admin. // validate for validating user if an admin.
@ -177,6 +178,7 @@ func (sia *SystemInfoAPI) GetGeneralInfo() {
HasCARoot: caStatErr == nil, HasCARoot: caStatErr == nil,
HarborVersion: harborVersion, HarborVersion: harborVersion,
RegistryStorageProviderName: cfg[common.RegistryStorageProviderName].(string), RegistryStorageProviderName: cfg[common.RegistryStorageProviderName].(string),
ReadOnly: config.ReadOnly(),
} }
if info.WithClair { if info.WithClair {
info.ClairVulnStatus = getClairVulnStatus() 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(false, g.WithNotary, "with notary should be false")
assert.Equal(true, g.HasCARoot, "has ca root should be true") assert.Equal(true, g.HasCARoot, "has ca root should be true")
assert.NotEmpty(g.HarborVersion, "harbor version should not be empty") assert.NotEmpty(g.HarborVersion, "harbor version should not be empty")
assert.Equal(false, g.ReadOnly, "readonly should be false")
} }
func TestGetCert(t *testing.T) { func TestGetCert(t *testing.T) {