32 lines
595 B
Go
32 lines
595 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
|
|
"inou/lib"
|
|
)
|
|
|
|
func main() {
|
|
if len(os.Args) < 4 {
|
|
fmt.Println("Usage: grant <dossier_id> <grantee_id> <role>")
|
|
fmt.Println("Example: grant 1111111111111111 4f1ffbc65c0a44d9 viewer")
|
|
os.Exit(1)
|
|
}
|
|
|
|
dossierID := os.Args[1]
|
|
granteeID := os.Args[2]
|
|
role := os.Args[3]
|
|
|
|
lib.CryptoInit("/tank/inou/master.key")
|
|
lib.DBInit("/tank/inou/data/inou.db")
|
|
|
|
err := lib.AccessGrantRole(dossierID, granteeID, role)
|
|
if err != nil {
|
|
fmt.Printf("Error: %v\n", err)
|
|
os.Exit(1)
|
|
}
|
|
|
|
fmt.Printf("Granted %s access to %s for %s\n", role, dossierID, granteeID)
|
|
}
|