Added better Tenanting
* Removed Tenanting from base objects as some models may be tenantless * Admins are naturally not restricted by tenants * Users *ARE* the tenants (for now) so they don't require a tenant ID either * User-owned models should all include the Tenanted model as their base * Created .Create and .Save methods attached to base model
This commit is contained in:
@@ -11,7 +11,7 @@ import (
|
||||
|
||||
type User struct {
|
||||
Auth
|
||||
Email string `gorm:"unique" sql:"index"`
|
||||
Email string `gorm:"unique;index"`
|
||||
}
|
||||
|
||||
const userJwtDuration = time.Hour * 24
|
||||
@@ -24,7 +24,6 @@ func (u *User) GetJwt() (string, int) {
|
||||
"iat": time.Now().Unix(),
|
||||
"exp": time.Now().Add(userJwtDuration).Unix(),
|
||||
"role": "user",
|
||||
"tid": u.Tenant.String(),
|
||||
})
|
||||
|
||||
jstr, err := j.SignedString(UserHmac)
|
||||
|
||||
Reference in New Issue
Block a user