Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unnecessary role #290

Merged
merged 1 commit into from
Jul 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/atomic/accounts/user.ex
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ defmodule Atomic.Accounts.User do
@required_fields ~w(email password role name)a
@optional_fields ~w(course_id)a

@roles ~w(admin staff student)a
@roles ~w(admin student)a

schema "users" do
field :email, :string
Expand Down
2 changes: 1 addition & 1 deletion lib/atomic_web/controllers/user_registration_controller.ex
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ defmodule AtomicWeb.UserRegistrationController do

conn =
conn
|> assign(:roles, ~w(admin staff student)a)
|> assign(:roles, ~w(admin student)a)

render(conn, "new.html", changeset: changeset)
end
Expand Down
2 changes: 1 addition & 1 deletion lib/atomic_web/live/activity_live/show.html.heex
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
<% end %>
</span>
<% end %>
<%= if @current_user.role in [:admin, :staff] do %>
<%= if @current_user.role in [:admin] do %>
<span><%= live_patch("Edit", to: Routes.activity_edit_path(@socket, :edit, @activity), class: "button") %></span> | <span><%= link("Delete", to: "#", phx_click: "delete", phx_value_id: @activity.id, data: [confirm: "Are you sure?"]) %></span> |
<span><%= live_redirect("Back", to: Routes.activity_index_path(@socket, :index)) %></span>
<% end %>
45 changes: 0 additions & 45 deletions priv/repo/seeds/accounts.exs
Original file line number Diff line number Diff line change
Expand Up @@ -99,51 +99,6 @@ defmodule Atomic.Repo.Seeds.Accounts do
]
|> create_users(:student)

[
"Bo Peep",
"Bugs Bunny",
"Buzz Lightyear",
"Captain Hook",
"Clara Cluck",
"Clarabelle Cow",
"Cruella de Vil",
"Daisy Duck",
"Dewey Duck",
"Doc Hudson",
"Donald Duck",
"Eddie Valiant",
"Horace Horsecollar",
"Huey Duck",
"Jessica Rabbit",
"Judge Doom",
"Lightning McQueen",
"Little John",
"Louie Duck",
"Maid Marian",
"Max Goof",
"Mickey Mouse",
"Minnie Mouse",
"Mortimer Mouse",
"Peter Pan",
"Potato Head",
"Prince John",
"Queen of Hearts",
"Robin Hood",
"Roger Rabbit",
"Sally Carrera",
"Scrooge McDuck",
"Speedy Gonzalez",
"Sheriff of Nottingham",
"Snow White",
"Tiger Lily",
"Tinker Bell",
"Tweedle Dee",
"Tweedle Dum",
"Wendy Darling",
"White Rabbit"
]
|> create_users(:staff)

_ ->
Mix.shell().error("Found users, aborting seeding users.")
end
Expand Down
2 changes: 1 addition & 1 deletion test/support/factories/accounts_factory.ex
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ defmodule Atomic.Factories.AccountFactory do

defmacro __using__(_opts) do
quote do
@roles ~w(admin staff student)a
@roles ~w(admin student)a

def user_factory do
%User{
Expand Down
2 changes: 1 addition & 1 deletion test/support/factories/organizations_factory.ex
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ defmodule Atomic.Factories.OrganizationFactory do
def membership_factory do
%Membership{
user: build(:user),
created_by: build(:user, role: "staff"),
created_by: build(:user, role: "admin"),
organization: build(:organization),
role: Enum.random(@roles)
}
Expand Down
Loading