Allow anon controlled metapurses
This commit is contained in:
parent
49883bcdbf
commit
4ae78edc49
@ -1,5 +1,5 @@
|
|||||||
class Metapurse < ActiveRecord::Base
|
class Metapurse < ActiveRecord::Base
|
||||||
belongs_to :user
|
belongs_to :user, optional: true
|
||||||
def icpswap_pool_data_raw
|
def icpswap_pool_data_raw
|
||||||
icpswap_pool_data_raw = `dfx --identity anonymous canister --network=ic call ggzvv-5qaaa-aaaag-qck7a-cai getAllPools`
|
icpswap_pool_data_raw = `dfx --identity anonymous canister --network=ic call ggzvv-5qaaa-aaaag-qck7a-cai getAllPools`
|
||||||
end
|
end
|
||||||
|
|||||||
@ -38,11 +38,11 @@ class MetapursePolicy
|
|||||||
end
|
end
|
||||||
|
|
||||||
def create?
|
def create?
|
||||||
@user.admin? || @user.signed_in?
|
@user.admin? || @user.signed_in? || true
|
||||||
end
|
end
|
||||||
|
|
||||||
def new?
|
def new?
|
||||||
@user.admin? || @user.signed_in?
|
@user.admin? || @user.signed_in? || true
|
||||||
end
|
end
|
||||||
|
|
||||||
def edit?
|
def edit?
|
||||||
@ -50,7 +50,7 @@ class MetapursePolicy
|
|||||||
end
|
end
|
||||||
|
|
||||||
def update?
|
def update?
|
||||||
@user.admin? || @metapurse.user == @user
|
@user.admin? || @metapurse.user == @user || @metapurse.user == nil
|
||||||
end
|
end
|
||||||
|
|
||||||
def destroy?
|
def destroy?
|
||||||
|
|||||||
@ -0,0 +1,5 @@
|
|||||||
|
class ChangeColumnUserIdOnMetaPurse < ActiveRecord::Migration[7.1]
|
||||||
|
def change
|
||||||
|
change_column :metapurses, :user_id, :integer, null: true
|
||||||
|
end
|
||||||
|
end
|
||||||
@ -10,7 +10,7 @@
|
|||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema[7.1].define(version: 2024_03_10_122622) do
|
ActiveRecord::Schema[7.1].define(version: 2024_03_25_135707) do
|
||||||
# These are extensions that must be enabled in order to support this database
|
# These are extensions that must be enabled in order to support this database
|
||||||
enable_extension "plpgsql"
|
enable_extension "plpgsql"
|
||||||
|
|
||||||
@ -112,7 +112,7 @@ ActiveRecord::Schema[7.1].define(version: 2024_03_10_122622) do
|
|||||||
t.text "data"
|
t.text "data"
|
||||||
t.datetime "created_at", null: false
|
t.datetime "created_at", null: false
|
||||||
t.datetime "updated_at", null: false
|
t.datetime "updated_at", null: false
|
||||||
t.bigint "user_id", null: false
|
t.integer "user_id"
|
||||||
t.index ["user_id"], name: "index_metapurses_on_user_id"
|
t.index ["user_id"], name: "index_metapurses_on_user_id"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user