MCPcopy
hub / github.com/ngoduykhanh/wireguard-ui / isAdmin

Function isAdmin

handler/session.go:207–215  ·  view source on GitHub ↗

isAdmin to get user type: admin or manager

(c echo.Context)

Source from the content-addressed store, hash-verified

205
206// isAdmin to get user type: admin or manager
207func isAdmin(c echo.Context) bool {
208 if util.DisableLogin {
209 return true
210 }
211
212 sess, _ := session.Get("session", c)
213 admin := fmt.Sprintf("%t", sess.Values["admin"])
214 return admin == "true"
215}
216
217func setUser(c echo.Context, username string, admin bool, userCRC32 uint32) {
218 sess, _ := session.Get("session", c)

Callers 11

GetUserFunction · 0.85
LoadProfileFunction · 0.85
UsersSettingsFunction · 0.85
UpdateUserFunction · 0.85
WireGuardClientsFunction · 0.85
WireGuardServerFunction · 0.85
GlobalSettingsFunction · 0.85
StatusFunction · 0.85
AboutPageFunction · 0.85
NeedsAdminFunction · 0.85
GetWakeOnLanHostsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected