mirror of
https://github.com/absmach/magistrala.git
synced 2026-06-23 04:10:28 +00:00
NOISSUE - Rename Admin to SuperAdmin role
Signed-off-by: dusan <borovcanindusan1@gmail.com>
This commit is contained in:
+1
-1
@@ -36,7 +36,7 @@ type Role uint32
|
||||
|
||||
const (
|
||||
UserRole Role = iota + 1
|
||||
AdminRole
|
||||
SuperAdminRole
|
||||
)
|
||||
|
||||
type Session struct {
|
||||
|
||||
@@ -138,7 +138,7 @@ func (a *authnMiddleware) Middleware() func(http.Handler) http.Handler {
|
||||
return
|
||||
}
|
||||
|
||||
if resp.Type == AccessToken && !opts.allowUnverifiedUser && resp.Role != AdminRole && !resp.Verified {
|
||||
if resp.Type == AccessToken && !opts.allowUnverifiedUser && resp.Role != SuperAdminRole && !resp.Verified {
|
||||
encodeError(w, apiutil.ErrEmailNotVerified, http.StatusUnauthorized)
|
||||
return
|
||||
}
|
||||
@@ -151,7 +151,7 @@ func (a *authnMiddleware) Middleware() func(http.Handler) http.Handler {
|
||||
}
|
||||
resp.DomainID = domain
|
||||
switch resp.Role {
|
||||
case AdminRole:
|
||||
case SuperAdminRole:
|
||||
resp.DomainUserID = resp.UserID
|
||||
case UserRole:
|
||||
resp.DomainUserID = policies.EncodeDomainUserID(domain, resp.UserID)
|
||||
|
||||
Reference in New Issue
Block a user