Skip to content

Commit

Permalink
fix: remove app permissions with invalid scopes (#353)
Browse files Browse the repository at this point in the history
  • Loading branch information
rolznz authored Jul 26, 2024
1 parent 45600ee commit c7513aa
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
28 changes: 28 additions & 0 deletions db/migrations/202407262257_remove_invalid_scopes.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package migrations

import (
_ "embed"

"github.com/go-gormigrate/gormigrate/v2"
"gorm.io/gorm"
)

// This migration removes old app permissions for request methods (now we use scopes)
var _202407262257_remove_invalid_scopes = &gormigrate.Migration{
ID: "202407262257_remove_invalid_scopes",
Migrate: func(tx *gorm.DB) error {

if err := tx.Exec(`
delete from app_permissions where scope = "pay_keysend";
delete from app_permissions where scope = "multi_pay_keysend";
delete from app_permissions where scope = "multi_pay_invoice";
`).Error; err != nil {
return err
}

return nil
},
Rollback: func(tx *gorm.DB) error {
return nil
},
}
1 change: 1 addition & 0 deletions db/migrations/migrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ func Migrate(gormDB *gorm.DB) error {
_202407012100_transactions,
_202407151352_autoincrement,
_202407201604_transactions_indexes,
_202407262257_remove_invalid_scopes,
})

return m.Migrate()
Expand Down
1 change: 0 additions & 1 deletion frontend/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ export interface ErrorResponse {

export interface App {
id: number;
userId: number;
name: string;
description: string;
nostrPubkey: string;
Expand Down

0 comments on commit c7513aa

Please sign in to comment.