default storesecret roleid to roleid of requesting user
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -36,12 +36,13 @@ func StoreSecret(c *gin.Context) {
|
||||
s.DeviceName = input.DeviceName
|
||||
s.DeviceCategory = input.DeviceCategory
|
||||
|
||||
// Default role ID is 1 if not defined
|
||||
// If RoleID is not defined then default to the same role as the user requesting secret to be stored
|
||||
if input.RoleId != 0 {
|
||||
s.RoleId = input.RoleId
|
||||
} else {
|
||||
log.Printf("StoreSecret setting default RoleId of 1\n")
|
||||
s.RoleId = 1
|
||||
ur, _ := models.GetUserRoleFromToken(c)
|
||||
log.Printf("StoreSecret RoleId was not specified, setting to RoleId of '%d'\n", ur.RoleId)
|
||||
s.RoleId = ur.RoleId
|
||||
}
|
||||
|
||||
if input.DeviceCategory == "" && input.DeviceName == "" {
|
||||
|
Reference in New Issue
Block a user