// Apply is run by the developer in the init.go file for his/her project. // It loops over the slice for all AuthenticatedResources the developer wishes // to be protected with authentication. func Apply(m []AuthenticatedResource) { for _, a := range m { var fc revel.FilterConfigurator if reflect.TypeOf(a.Resource).Kind() == reflect.Func { fc = revel.FilterAction(a.Resource) } else { fc = revel.FilterController(a.Resource) } fc.Add(SessionAuthenticationFilter) } }
func AclApply(m []AuthenticatedResource) { // revel.FilterController(controllers.Admin{}). // Add(AuthenticationFilter) for _, a := range m { var fc revel.FilterConfigurator if reflect.TypeOf(a.Resource).Kind() == reflect.Func { // revel action fc = revel.FilterAction(a.Resource) } else { // revel controller fc = revel.FilterController(a.Resource) } fc.Add(SessionAuthenticationFilter) } }