|
Lines 62-69
if [ "$op" == 'generate' ]; then
Link Here
|
| 62 |
usage |
62 |
usage |
| 63 |
die "Unknown instance '$instance'" |
63 |
die "Unknown instance '$instance'" |
| 64 |
) |
64 |
) |
| 65 |
|
65 |
if ! koha-shell -c "perl -MKoha::Patrons -e \"Koha::Patrons->find($borrowernumber) or die;\"" "$instance" 2>/dev/null; then |
| 66 |
if ! perl -MKoha::Patrons -e "Koha::Patrons->find($borrowernumber) or die;" 2>/dev/null; then |
|
|
| 67 |
die "Unknown borrowernumber: '$borrowernumber'" |
66 |
die "Unknown borrowernumber: '$borrowernumber'" |
| 68 |
fi |
67 |
fi |
| 69 |
|
68 |
|
|
Lines 71-77
if [ "$op" == 'generate' ]; then
Link Here
|
| 71 |
read -r client_id |
70 |
read -r client_id |
| 72 |
read -r secret |
71 |
read -r secret |
| 73 |
} < <( |
72 |
} < <( |
| 74 |
perl -MKoha::ApiKeys -e "my \$key = Koha::ApiKey->new( { patron_id => $borrowernumber, description => '$description' } )->store; printf \"%s\n%s\n\", \$key->client_id, \$key->plain_text_secret;" |
73 |
koha-shell -c "perl -MKoha::ApiKeys -e \"my \\\$key = Koha::ApiKey->new( { patron_id => $borrowernumber, description => '$description' } )->store; printf \\\"%s\\n%s\\n\\\", \\\$key->client_id, \\\$key->plain_text_secret;\"" "$instance" |
| 75 |
) |
74 |
) |
| 76 |
|
75 |
|
| 77 |
printf "Client ID:\t%s\nClient Secret:\t%s\n" "$client_id" "$secret" |
76 |
printf "Client ID:\t%s\nClient Secret:\t%s\n" "$client_id" "$secret" |
|
Lines 87-93
if [ "$op" == 'delete' ]; then
Link Here
|
| 87 |
) |
86 |
) |
| 88 |
|
87 |
|
| 89 |
read -rp "Client ID to delete: " client_id |
88 |
read -rp "Client ID to delete: " client_id |
| 90 |
if ! perl -MKoha::ApiKeys -e "Koha::ApiKeys->find('$client_id')->delete or die;" 2>/dev/null; then |
89 |
if ! koha-shell -c "perl -MKoha::ApiKeys -e \"Koha::ApiKeys->find(\\\"$client_id\\\")->delete or die;\"" "$instance" 2>/dev/null; then |
| 91 |
die "Unknown client id: '$client_id'" |
90 |
die "Unknown client id: '$client_id'" |
| 92 |
fi |
91 |
fi |
| 93 |
|
92 |
|
| 94 |
- |
|
|