mirror of
https://github.com/portainer/portainer.git
synced 2025-11-26 14:06:05 +08:00
feat(rbac): detect if rbac is enabled [EE-4308] (#8139)
This commit is contained in:
14
api/internal/randomstring/random_string.go
Normal file
14
api/internal/randomstring/random_string.go
Normal file
@@ -0,0 +1,14 @@
|
||||
package randomstring
|
||||
|
||||
import "math/rand"
|
||||
|
||||
const letterBytes = "abcdefghijklmnopqrstuvwxyz0123456789"
|
||||
|
||||
// RandomString returns a random lowercase alphanumeric string of length n
|
||||
func RandomString(n int) string {
|
||||
b := make([]byte, n)
|
||||
for i := range b {
|
||||
b[i] = letterBytes[rand.Intn(len(letterBytes))]
|
||||
}
|
||||
return string(b)
|
||||
}
|
||||
Reference in New Issue
Block a user