Skip to content

Commit f2e84e8

Browse files
committed
http middleware helper improvements
1 parent 4ef226b commit f2e84e8

File tree

3 files changed

+29
-1
lines changed

3 files changed

+29
-1
lines changed

Diff for: core/listeners/http/middlewares/authentication/auth_details_functions.go

+12
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,18 @@ func (a *AuthDetails) UserUUID() uuid.UUID {
1616
return id
1717
}
1818

19+
func (a *AuthDetails) GetFullName() string {
20+
return a.UserDetails.GetFullName()
21+
}
22+
23+
func (a *AuthDetails) GetRole() string {
24+
return a.UserDetails.GetRole()
25+
}
26+
27+
func (a *AuthDetails) GetUserType() string {
28+
return a.UserDetails.GetUserType()
29+
}
30+
1931
//-------------------------------------\\
2032

2133
func (a *AuthDetails) GetDeviceID() string {

Diff for: core/listeners/http/middlewares/authentication/auth_details_model.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,10 @@ type UserDetails struct {
3737
LastName string
3838
Username string
3939
IsActive bool
40-
UserType string
40+
// UserType -> admin, client etc...
41+
UserType string
42+
// Role -> SuperAdmin, Admin, SalesMan etc...
43+
Role string
4144

4245
// Secondary
4346
Phone1 string
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package authentication
2+
3+
func (u *UserDetails) GetFullName() string {
4+
return u.FirstName + " " + u.LastName
5+
}
6+
7+
func (u *UserDetails) GetRole() string {
8+
return u.Role
9+
}
10+
11+
func (u *UserDetails) GetUserType() string {
12+
return u.UserType
13+
}

0 commit comments

Comments
 (0)