Fix Credo Design (AliasUsage): add aliases in lib
Add module aliases at top and use short names instead of fully qualified nested modules across lib/.
This commit is contained in:
parent
cfc8900c5c
commit
7a8b069834
25 changed files with 176 additions and 109 deletions
|
|
@ -7,9 +7,11 @@ defmodule Mv.Authorization.Checks.ActorIsSystemUser do
|
|||
"""
|
||||
use Ash.Policy.SimpleCheck
|
||||
|
||||
alias Mv.Helpers.SystemActor
|
||||
|
||||
@impl true
|
||||
def describe(_opts), do: "actor is the system user"
|
||||
|
||||
@impl true
|
||||
def match?(actor, _context, _opts), do: Mv.Helpers.SystemActor.system_user?(actor)
|
||||
def match?(actor, _context, _opts), do: SystemActor.system_user?(actor)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ defmodule Mv.Authorization.Checks.CustomFieldValueCreateScope do
|
|||
end
|
||||
"""
|
||||
use Ash.Policy.Check
|
||||
alias Mv.Authorization.Actor
|
||||
alias Mv.Authorization.PermissionSets
|
||||
|
||||
@impl true
|
||||
|
|
@ -67,5 +68,5 @@ defmodule Mv.Authorization.Checks.CustomFieldValueCreateScope do
|
|||
end
|
||||
end
|
||||
|
||||
defp ensure_role_loaded(actor), do: Mv.Authorization.Actor.ensure_loaded(actor)
|
||||
defp ensure_role_loaded(actor), do: Actor.ensure_loaded(actor)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -81,6 +81,7 @@ defmodule Mv.Authorization.Checks.HasPermission do
|
|||
use Ash.Policy.Check
|
||||
require Ash.Query
|
||||
import Ash.Expr
|
||||
alias Mv.Authorization.Actor
|
||||
alias Mv.Authorization.PermissionSets
|
||||
require Logger
|
||||
|
||||
|
|
@ -397,6 +398,6 @@ defmodule Mv.Authorization.Checks.HasPermission do
|
|||
# Fallback: Load role if not loaded (in case on_mount didn't run)
|
||||
# Delegates to centralized Actor helper
|
||||
defp ensure_role_loaded(actor) do
|
||||
Mv.Authorization.Actor.ensure_loaded(actor)
|
||||
Actor.ensure_loaded(actor)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue