Skip to content

Commit

Permalink
Handle nil value for role repos (#1259)
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeljguarino authored Oct 5, 2023
1 parent 877ee42 commit 96ef184
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .tool-versions
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
erlang 24.3.4.10
erlang 24.3.4.13
elixir 1.12.3
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ asdf can be finnicky when instlalling erlang with mac, in which case you can res

```sh
brew install erlang@24
cp -r /opt/homebrew/opt/erlang@24/lib/erlang ~/.asdf/installs/erlang/24.3.4.10
asdf reshim erlang 24.3.4.10
cp -r /opt/homebrew/opt/erlang@24/lib/erlang ~/.asdf/installs/erlang/24.3.4.13
asdf reshim erlang 24.3.4.13
```

<!-- >
Expand Down
3 changes: 2 additions & 1 deletion apps/core/lib/core/services/rbac.ex
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,12 @@ defmodule Core.Services.Rbac do
do: Enum.filter(roles, & &1.account_id == id)
defp maybe_filter(roles, _, _), do: roles

defp matches_repository?(%Role{repositories: repos}, repository) do
defp matches_repository?(%Role{repositories: [_ | _] = repos}, repository) do
repos
|> Enum.map(& "^#{String.replace(&1, "*", ".*")}$" |> Regex.compile!())
|> Enum.any?(&Regex.match?(&1, repository))
end
defp matches_repository?(_, _), do: false

defp permits_action?(%Role{permissions: %Role.Permissions{} = perms}, action),
do: Map.get(perms, action)
Expand Down
2 changes: 1 addition & 1 deletion apps/rtc/lib/rtc_web/channels/shell_channel.ex
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
defmodule RtcWeb.ShellChannel do
use RtcWeb, :channel
alias Core.Services.{Shell.Pods, Shell}
alias Core.Schema.{CloudShell, User}
alias Core.Schema.{CloudShell}

require Logger

Expand Down

0 comments on commit 96ef184

Please sign in to comment.