Skip to content

Commit

Permalink
[identity] fix wallet user deletion
Browse files Browse the repository at this point in the history
  • Loading branch information
patatoid committed Oct 17, 2024
1 parent bfd884b commit 740376b
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,16 @@ defmodule BorutaIdentity.Accounts.Wallet do
alias BorutaIdentity.Accounts.User
alias BorutaIdentity.Repo

@account_type "wallet"

def account_type, do: @account_type

def domain_user!(resource_owner, backend) do
impl_user_params = %{
uid: resource_owner.sub,
username: resource_owner.sub,
backend_id: backend.id
backend_id: backend.id,
account_type: @account_type
}

metadata = resource_owner.extra_claims
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,12 @@ defmodule BorutaIdentity.Accounts.User do
}

def account_types, do: [
BorutaIdentity.Accounts.Federated.account_type(),
# user registries
BorutaIdentity.Accounts.Internal.account_type(),
BorutaIdentity.Accounts.Ldap.account_type()
BorutaIdentity.Accounts.Ldap.account_type(),
# user interfaces
BorutaIdentity.Accounts.Federated.account_type(),
BorutaIdentity.Accounts.Wallet.account_type()
]

@derive {Inspect, except: [:password]}
Expand Down
13 changes: 13 additions & 0 deletions apps/boruta_identity/test/boruta_identity/admin_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,19 @@ defmodule BorutaIdentity.AdminTest do
end
end


describe "delete_user/1 with wallet backend" do
test "returns an error" do
assert Admin.delete_user("did:key:test") == {:error, :not_found}
end

test "returns deleted user" do
%User{id: user_id} = user_fixture(%{}, "wallet")
assert {:ok, %User{id: ^user_id}} = Admin.delete_user(user_id)
refute Repo.get(User, user_id)
end
end

@tag :skip
test "delete_user/1 with ldap backend"

Expand Down
2 changes: 1 addition & 1 deletion mix.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"argon2_elixir": {:hex, :argon2_elixir, "2.4.1", "edb27bdd326bc738f3e4614eddc2f73507be6fedc9533c6bcc6f15bbac9c85cc", [:make, :mix], [{:comeonin, "~> 5.3", [hex: :comeonin, repo: "hexpm", optional: false]}, {:elixir_make, "~> 0.6", [hex: :elixir_make, repo: "hexpm", optional: false]}], "hexpm", "0e21f52a373739d00bdfd5fe6da2f04eea623cb4f66899f7526dd9db03903d9f"},
"asn1_compiler": {:hex, :asn1_compiler, "0.1.1", "64a4e52b59d1f225878445ace2c75cd2245b13a5a81182304fd9dc5acfc8994e", [:mix], [], "hexpm", "c250d24c22f1a3f305d88864400f9ac2df55c6886e1e3a030e2946efeb94695e"},
"bcrypt_elixir": {:hex, :bcrypt_elixir, "3.1.0", "0b110a9a6c619b19a7f73fa3004aa11d6e719a67e672d1633dc36b6b2290a0f7", [:make, :mix], [{:comeonin, "~> 5.3", [hex: :comeonin, repo: "hexpm", optional: false]}, {:elixir_make, "~> 0.6", [hex: :elixir_make, repo: "hexpm", optional: false]}], "hexpm", "2ad2acb5a8bc049e8d5aa267802631912bb80d5f4110a178ae7999e69dca1bf7"},
"boruta": {:git, "https://github.com/malach-it/boruta_auth.git", "63abc203222790c252dcca446ef8ed652e8f8624", [branch: "poc-hybrid-vp-token"]},
"boruta": {:git, "https://github.com/malach-it/boruta_auth.git", "3fde634b0c23fd37b26c81da2111ae25d40d4daa", [branch: "poc-hybrid-vp-token"]},
"bunt": {:hex, :bunt, "1.0.0", "081c2c665f086849e6d57900292b3a161727ab40431219529f13c4ddcf3e7a44", [:mix], [], "hexpm", "dc5f86aa08a5f6fa6b8096f0735c4e76d54ae5c9fa2c143e5a1fc7c1cd9bb6b5"},
"bypass": {:hex, :bypass, "2.1.0", "909782781bf8e20ee86a9cabde36b259d44af8b9f38756173e8f5e2e1fabb9b1", [:mix], [{:plug, "~> 1.7", [hex: :plug, repo: "hexpm", optional: false]}, {:plug_cowboy, "~> 2.0", [hex: :plug_cowboy, repo: "hexpm", optional: false]}, {:ranch, "~> 1.3", [hex: :ranch, repo: "hexpm", optional: false]}], "hexpm", "d9b5df8fa5b7a6efa08384e9bbecfe4ce61c77d28a4282f79e02f1ef78d96b80"},
"castore": {:hex, :castore, "1.0.8", "dedcf20ea746694647f883590b82d9e96014057aff1d44d03ec90f36a5c0dc6e", [:mix], [], "hexpm", "0b2b66d2ee742cb1d9cb8c8be3b43c3a70ee8651f37b75a8b982e036752983f1"},
Expand Down

0 comments on commit 740376b

Please sign in to comment.