diff options
author | Tuomo Ala-Vannesluoma <tuomoav@gmail.com> | 2018-06-30 22:31:06 +0300 |
---|---|---|
committer | Tuomo Ala-Vannesluoma <tuomoav@gmail.com> | 2018-06-30 22:51:43 +0300 |
commit | 9681f91e84e78035f48f85c320ae1a3aa4b6ee07 (patch) | |
tree | cddf5e01cb656e219cf1e13458e5b02434bca8ec /internal | |
parent | a57640fd330cc854b0d48a3b685dd61bec9cf57d (diff) |
Combine private boolean with the access_control flag
Diffstat (limited to 'internal')
-rw-r--r-- | internal/domain/domain.go | 12 | ||||
-rw-r--r-- | internal/domain/domain_config.go | 1 | ||||
-rw-r--r-- | internal/domain/map.go | 7 |
3 files changed, 3 insertions, 17 deletions
diff --git a/internal/domain/domain.go b/internal/domain/domain.go index aecbb93d..bf0129c8 100644 --- a/internal/domain/domain.go +++ b/internal/domain/domain.go @@ -25,7 +25,6 @@ type locationDirectoryError struct { type project struct { HTTPSOnly bool - Private bool AccessControl bool ID uint64 } @@ -135,17 +134,6 @@ func (d *D) IsAccessControlEnabled(r *http.Request) bool { return false } -// IsPrivate figures out if the request is to a project that needs user to sign in -func (d *D) IsPrivate(r *http.Request) bool { - project := d.getProject(r) - - if project != nil { - return project.Private - } - - return false -} - // GetID figures out what is the ID of the project user tries to access func (d *D) GetID(r *http.Request) uint64 { project := d.getProject(r) diff --git a/internal/domain/domain_config.go b/internal/domain/domain_config.go index 3b1c9419..672f939c 100644 --- a/internal/domain/domain_config.go +++ b/internal/domain/domain_config.go @@ -17,7 +17,6 @@ type domainConfig struct { type domainsConfig struct { Domains []domainConfig HTTPSOnly bool `json:"https_only"` - Private bool `json:"private"` ID uint64 `json:"id"` AccessControl bool `json:"access_control"` } diff --git a/internal/domain/map.go b/internal/domain/map.go index 3b72009f..5c6d5f5d 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 uint64) { +func (dm Map) updateGroupDomain(rootDomain, group, projectName string, httpsOnly bool, accessControl bool, id uint64) { domainName := strings.ToLower(group + "." + rootDomain) groupDomain := dm[domainName] @@ -45,7 +45,6 @@ func (dm Map) updateGroupDomain(rootDomain, group, projectName string, httpsOnly groupDomain.projects[projectName] = &project{ HTTPSOnly: httpsOnly, - Private: private, AccessControl: accessControl, ID: id, } @@ -58,11 +57,11 @@ 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, 0) + dm.updateGroupDomain(rootDomain, group, projectName, false, false, 0) return } - dm.updateGroupDomain(rootDomain, group, projectName, config.HTTPSOnly, config.Private, config.AccessControl, config.ID) + dm.updateGroupDomain(rootDomain, group, projectName, config.HTTPSOnly, config.AccessControl, config.ID) for _, domainConfig := range config.Domains { config := domainConfig // domainConfig is reused for each loop iteration |