From 336cd671ccdaaac2755d30aa9965d22ec7551ebc Mon Sep 17 00:00:00 2001 From: ale Date: Fri, 21 Jun 2019 11:42:42 +0100 Subject: [PATCH] Remove Database.CleartextPassword from the data model There's no reason for it to be exposed, it is currently an implementation detail in how new MySQL databases are created (the password reset flow for databases does not use it after that). --- API.md | 1 - backend/ldap/model_test.go | 3 +-- backend/ldap/resources.go | 4 +--- backend/ldap/resources_test.go | 3 +-- types.go | 3 +-- 5 files changed, 4 insertions(+), 10 deletions(-) diff --git a/API.md b/API.md index bb2f0e5..0c54fdd 100644 --- a/API.md +++ b/API.md @@ -256,7 +256,6 @@ This is an example of a simple user, as returned by `/api/user/get`: "group": "uno", "database": { "db_user": "unodb", - "cleartext_password": "password" } }, { diff --git a/backend/ldap/model_test.go b/backend/ldap/model_test.go index 5a22f3a..4002f89 100644 --- a/backend/ldap/model_test.go +++ b/backend/ldap/model_test.go @@ -116,8 +116,7 @@ func TestModel_GetUser(t *testing.T) { OriginalShard: "host2", Status: as.ResourceStatusActive, Database: &as.Database{ - CleartextPassword: "password", - DBUser: "unodb", + DBUser: "unodb", }, } if err := deep.Equal(db, expectedDB); err != nil { diff --git a/backend/ldap/resources.go b/backend/ldap/resources.go index d35cb4f..24d59cb 100644 --- a/backend/ldap/resources.go +++ b/backend/ldap/resources.go @@ -430,8 +430,7 @@ func (h *databaseResourceHandler) FromLDAP(entry *ldap.Entry) (*as.Resource, err ParentID: as.ResourceID(parentDN), Name: name, Database: &as.Database{ - DBUser: entry.GetAttributeValue("dbuser"), - CleartextPassword: entry.GetAttributeValue("clearPassword"), + DBUser: entry.GetAttributeValue("dbuser"), }, }, nil } @@ -441,7 +440,6 @@ func (h *databaseResourceHandler) ToLDAP(rsrc *as.Resource) []ldap.PartialAttrib {Type: "objectClass", Vals: []string{"top", "dbMysql"}}, {Type: "dbname", Vals: s2l(rsrc.Name)}, {Type: "dbuser", Vals: s2l(rsrc.Database.DBUser)}, - {Type: "clearPassword", Vals: s2l(rsrc.Database.CleartextPassword)}, } } diff --git a/backend/ldap/resources_test.go b/backend/ldap/resources_test.go index 875386c..fe7f917 100644 --- a/backend/ldap/resources_test.go +++ b/backend/ldap/resources_test.go @@ -108,8 +108,7 @@ func TestResource_LDAPSerialization(t *testing.T) { Name: "testdb", Status: as.ResourceStatusActive, Database: &as.Database{ - DBUser: "testdbuser", - CleartextPassword: "secretpassword", + DBUser: "testdbuser", }, }, diff --git a/types.go b/types.go index 3a92408..4b87fe0 100644 --- a/types.go +++ b/types.go @@ -562,8 +562,7 @@ type Website struct { // Database resource attributes. type Database struct { - DBUser string `json:"db_user"` - CleartextPassword string `json:"cleartext_password"` + DBUser string `json:"db_user"` } // CMSInfo holds CMS-specific information. -- GitLab