diff options
author | Tuomo Ala-Vannesluoma <tuomoav@gmail.com> | 2018-06-18 00:20:20 +0300 |
---|---|---|
committer | Tuomo Ala-Vannesluoma <tuomoav@gmail.com> | 2018-06-30 22:51:43 +0300 |
commit | 5828ffbece3a751198a2f9a0c7c8b144d13179c4 (patch) | |
tree | 1744501b7ca99eb9d59f92c08feee8bca80171a1 /internal | |
parent | 301dd4675e9df8ccc8ad47fe7f2c40c03428ddb2 (diff) |
Change project id to uint64
Diffstat (limited to 'internal')
-rw-r--r-- | internal/auth/auth.go | 2 | ||||
-rw-r--r-- | internal/domain/domain.go | 6 | ||||
-rw-r--r-- | internal/domain/domain_config.go | 8 | ||||
-rw-r--r-- | internal/domain/map.go | 4 |
4 files changed, 10 insertions, 10 deletions
diff --git a/internal/auth/auth.go b/internal/auth/auth.go index d64a4053..a3d44dc6 100644 --- a/internal/auth/auth.go +++ b/internal/auth/auth.go @@ -184,7 +184,7 @@ func (a *Auth) fetchAccessToken(code string) (tokenResponse, error) { } // CheckAuthentication checks if user is authenticated and has access to the project -func (a *Auth) CheckAuthentication(w http.ResponseWriter, r *http.Request, projectID int) bool { +func (a *Auth) CheckAuthentication(w http.ResponseWriter, r *http.Request, projectID uint64) bool { if a == nil { httperrors.Serve500(w) diff --git a/internal/domain/domain.go b/internal/domain/domain.go index 3aef96f5..aecbb93d 100644 --- a/internal/domain/domain.go +++ b/internal/domain/domain.go @@ -27,7 +27,7 @@ type project struct { HTTPSOnly bool Private bool AccessControl bool - ID int + ID uint64 } type projects map[string]*project @@ -147,14 +147,14 @@ func (d *D) IsPrivate(r *http.Request) bool { } // GetID figures out what is the ID of the project user tries to access -func (d *D) GetID(r *http.Request) int { +func (d *D) GetID(r *http.Request) uint64 { project := d.getProject(r) if project != nil { return project.ID } - return -1 + return 0 } func (d *D) serveFile(w http.ResponseWriter, r *http.Request, origPath string) error { diff --git a/internal/domain/domain_config.go b/internal/domain/domain_config.go index 1acb3461..3b1c9419 100644 --- a/internal/domain/domain_config.go +++ b/internal/domain/domain_config.go @@ -16,10 +16,10 @@ type domainConfig struct { type domainsConfig struct { Domains []domainConfig - HTTPSOnly bool `json:"https_only"` - Private bool `json:"private"` - ID int `json:"id"` - AccessControl bool `json:"access_control"` + HTTPSOnly bool `json:"https_only"` + Private bool `json:"private"` + ID uint64 `json:"id"` + AccessControl bool `json:"access_control"` } func (c *domainConfig) Valid(rootDomain string) bool { diff --git a/internal/domain/map.go b/internal/domain/map.go index a6537bda..3b72009f 100644 --- a/internal/domain/map.go +++ b/internal/domain/map.go @@ -32,7 +32,7 @@ func (dm Map) addDomain(rootDomain, group, projectName string, config *domainCon dm[domainName] = newDomain } -func (dm Map) updateGroupDomain(rootDomain, group, projectName string, httpsOnly bool, private bool, accessControl bool, id int) { +func (dm Map) updateGroupDomain(rootDomain, group, projectName string, httpsOnly bool, private bool, accessControl bool, id uint64) { domainName := strings.ToLower(group + "." + rootDomain) groupDomain := dm[domainName] @@ -58,7 +58,7 @@ func (dm Map) readProjectConfig(rootDomain string, group, projectName string, co // This is necessary to preserve the previous behaviour where a // group domain is created even if no config.json files are // loaded successfully. Is it safe to remove this? - dm.updateGroupDomain(rootDomain, group, projectName, false, false, false, -1) + dm.updateGroupDomain(rootDomain, group, projectName, false, false, false, 0) return } |