Adding static roles

This commit is contained in:
Lukas Bachschwell 2018-11-15 18:10:07 +01:00
parent 1b41ad660a
commit 5ab2296187
2 changed files with 9 additions and 1 deletions

7
constants/role.go Normal file
View File

@ -0,0 +1,7 @@
package constants
const (
RoleOwner = iota
RoleAdmin
RoleUser
)

View File

@ -6,6 +6,7 @@ import (
companydb "multitenantStack/services/companydb"
"strings"
constants "multitenantStack/constants"
tokenTools "multitenantStack/services/tokenTools"
"time"
@ -230,7 +231,7 @@ func (c *AuthController) Register() {
var companyUser models.CompanyUser
companyUser.Name = username
companyUser.Profile = "{}"
companyUser.Role = 1 //TODO: replacxe with owner constant
companyUser.Role = constants.RoleOwner
userID, err := models.AddCompanyUser(newO, &companyUser)
if err != nil {