Remove binary
This commit is contained in:
parent
12f6dafb2f
commit
331812b2e7
2 changed files with 45 additions and 0 deletions
2
scripts/test_credentials/.gitignore
vendored
Normal file
2
scripts/test_credentials/.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
*.csv
|
||||
*.xlsx
|
43
scripts/test_credentials/main.go
Normal file
43
scripts/test_credentials/main.go
Normal file
|
@ -0,0 +1,43 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"log"
|
||||
|
||||
"git.andreafazzi.eu/andrea/oef/client"
|
||||
"git.andreafazzi.eu/andrea/oef/orm"
|
||||
)
|
||||
|
||||
func login(url string, user *orm.User) error {
|
||||
log.Printf("Obtaining token for user %s (%s %s)", user, user.Username, user.Password)
|
||||
_, err := client.GetToken(url, user.Username, user.Password)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func main() {
|
||||
username := flag.String("username", "admin", "Username")
|
||||
password := flag.String("password", "admin", "Password")
|
||||
|
||||
flag.Parse()
|
||||
|
||||
client, err := client.Dial(flag.Arg(0), *username, *password)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
users := make([]*orm.User, 0)
|
||||
|
||||
log.Println("Get all users...")
|
||||
err = client.ReadAll(&users)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
for _, user := range users {
|
||||
login(flag.Arg(0), user)
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in a new issue