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.DeviceName = input.DeviceName
|
||||||
s.DeviceCategory = input.DeviceCategory
|
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 {
|
if input.RoleId != 0 {
|
||||||
s.RoleId = input.RoleId
|
s.RoleId = input.RoleId
|
||||||
} else {
|
} else {
|
||||||
log.Printf("StoreSecret setting default RoleId of 1\n")
|
ur, _ := models.GetUserRoleFromToken(c)
|
||||||
s.RoleId = 1
|
log.Printf("StoreSecret RoleId was not specified, setting to RoleId of '%d'\n", ur.RoleId)
|
||||||
|
s.RoleId = ur.RoleId
|
||||||
}
|
}
|
||||||
|
|
||||||
if input.DeviceCategory == "" && input.DeviceName == "" {
|
if input.DeviceCategory == "" && input.DeviceName == "" {
|
||||||
|
Reference in New Issue
Block a user