Allow anon controlled metapurses
This commit is contained in:
parent
49883bcdbf
commit
4ae78edc49
@ -1,5 +1,5 @@
|
||||
class Metapurse < ActiveRecord::Base
|
||||
belongs_to :user
|
||||
belongs_to :user, optional: true
|
||||
def icpswap_pool_data_raw
|
||||
icpswap_pool_data_raw = `dfx --identity anonymous canister --network=ic call ggzvv-5qaaa-aaaag-qck7a-cai getAllPools`
|
||||
end
|
||||
|
||||
@ -38,11 +38,11 @@ class MetapursePolicy
|
||||
end
|
||||
|
||||
def create?
|
||||
@user.admin? || @user.signed_in?
|
||||
@user.admin? || @user.signed_in? || true
|
||||
end
|
||||
|
||||
def new?
|
||||
@user.admin? || @user.signed_in?
|
||||
@user.admin? || @user.signed_in? || true
|
||||
end
|
||||
|
||||
def edit?
|
||||
@ -50,7 +50,7 @@ class MetapursePolicy
|
||||
end
|
||||
|
||||
def update?
|
||||
@user.admin? || @metapurse.user == @user
|
||||
@user.admin? || @metapurse.user == @user || @metapurse.user == nil
|
||||
end
|
||||
|
||||
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.
|
||||
|
||||
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
|
||||
enable_extension "plpgsql"
|
||||
|
||||
@ -112,7 +112,7 @@ ActiveRecord::Schema[7.1].define(version: 2024_03_10_122622) do
|
||||
t.text "data"
|
||||
t.datetime "created_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"
|
||||
end
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user