diff --git a/database/db-types.go b/database/db-types.go index 461bbfa..9aa3145 100644 --- a/database/db-types.go +++ b/database/db-types.go @@ -6,7 +6,7 @@ import ( ) type User struct { - Sub string `json:"sub"` + Subject string `json:"subject"` Email string `json:"email"` EmailVerified bool `json:"email_verified"` Roles string `json:"roles"` @@ -16,13 +16,13 @@ type User struct { } type ClientInfoDbOutput struct { - Sub, Name, Secret, Domain, Owner, Perms string - Public, SSO, Active bool + Subject, Name, Secret, Domain, Owner, Perms string + Public, Sso, Active bool } var _ oauth2.ClientInfo = &ClientInfoDbOutput{} -func (c *ClientInfoDbOutput) GetID() string { return c.Sub } +func (c *ClientInfoDbOutput) GetID() string { return c.Subject } func (c *ClientInfoDbOutput) GetSecret() string { return c.Secret } func (c *ClientInfoDbOutput) GetDomain() string { return c.Domain } func (c *ClientInfoDbOutput) IsPublic() bool { return c.Public } @@ -34,7 +34,7 @@ func (c *ClientInfoDbOutput) GetName() string { return c.Name } // IsSSO is an extra field for the oauth handler to skip the user input stage // this is for trusted applications to get permissions without asking the user -func (c *ClientInfoDbOutput) IsSSO() bool { return c.SSO } +func (c *ClientInfoDbOutput) IsSSO() bool { return c.Sso } // IsActive is an extra field for the app manager to get the active state func (c *ClientInfoDbOutput) IsActive() bool { return c.Active } diff --git a/database/tx.go b/database/tx.go index d2bdba8..7190b35 100644 --- a/database/tx.go +++ b/database/tx.go @@ -57,7 +57,7 @@ func (t *Tx) GetUser(sub string) (*User, error) { var u User row := t.tx.QueryRow(`SELECT email, email_verified, roles, userinfo, updated_at, active FROM users WHERE subject = ?`, sub) err := row.Scan(&u.Email, &u.EmailVerified, &u.Roles, &u.UserInfo, &u.UpdatedAt, &u.Active) - u.Sub = sub + u.Subject = sub return &u, err } @@ -71,7 +71,7 @@ func (t *Tx) GetUserEmail(sub string) (string, error) { func (t *Tx) GetClientInfo(sub string) (oauth2.ClientInfo, error) { var u ClientInfoDbOutput row := t.tx.QueryRow(`SELECT secret, name, domain, perms, public, sso, active FROM client_store WHERE subject = ? LIMIT 1`, sub) - err := row.Scan(&u.Secret, &u.Name, &u.Domain, &u.Perms, &u.Public, &u.SSO, &u.Active) + err := row.Scan(&u.Secret, &u.Name, &u.Domain, &u.Perms, &u.Public, &u.Sso, &u.Active) u.Owner = sub if !u.Active { return nil, fmt.Errorf("client is not active") @@ -88,7 +88,7 @@ func (t *Tx) GetAppList(owner string, admin bool, offset int) ([]ClientInfoDbOut defer row.Close() for row.Next() { var a ClientInfoDbOutput - err := row.Scan(&a.Sub, &a.Name, &a.Domain, &a.Owner, &a.Perms, &a.Public, &a.SSO, &a.Active) + err := row.Scan(&a.Subject, &a.Name, &a.Domain, &a.Owner, &a.Perms, &a.Public, &a.Sso, &a.Active) if err != nil { return nil, err } @@ -129,7 +129,7 @@ func (t *Tx) GetUserList(offset int) ([]User, error) { } for row.Next() { var a User - err := row.Scan(&a.Sub, &a.Email, &a.EmailVerified, &a.Roles, &a.UpdatedAt, &a.Active) + err := row.Scan(&a.Subject, &a.Email, &a.EmailVerified, &a.Roles, &a.UpdatedAt, &a.Active) if err != nil { return nil, err } diff --git a/pages/manage-apps.go.html b/pages/manage-apps.go.html index f290372..31abb87 100644 --- a/pages/manage-apps.go.html +++ b/pages/manage-apps.go.html @@ -40,39 +40,39 @@