Answer by Jason Harrelson for How to restrict access to certain routes in...
You could also define a separate pipeline for the authenticated endpoints:defmodule MyApp.Router do use MyApp.Web, :router pipeline :admin do plug :accepts, ["html"] plug Authentication # this...
View ArticleAnswer by Chris McCord for How to restrict access to certain routes in Phoenix?
You would use a plug in the UserController. 0.4.x has no ability for conditionally plug s, but you could achieve what you want with something like: defmodule MyApp.UserController do use...
View ArticleHow to restrict access to certain routes in Phoenix?
I have a small Phoenix application allowing users to login and consult their profile. I used the following simple route:resources "/users", MyApp.UserControllerBut this allows every user to see the...
View ArticleAnswer by tblev for How to restrict access to certain routes in Phoenix?
Building off of Chris Mccord you can actually do this without taking up a lot of space in the controller. Like this:defmodule MyAppWeb.CategoryController do use MyAppWeb, :controller use...
View Article