Great - I saw your code commits. I'll close the issue. Thanks.
I also created a new issue "ESME-346" for the multiple roles / user. D. On Mon, May 9, 2011 at 1:30 PM, Vladimir Ivanov <[email protected]> wrote: > Yes I have LDAP env active. > > I've tested it in production mode and access to logchanger now works as > expected. But it required some changes in source code: > > First of all I added logic to UserAuth.scala and User.scala to be able to > save LDAP role for current user. Note that current implementation of User > class allows only one role to be set for current user. This might be changed > to list of roles in future. > > Then I changed scope of 'currentRole' var of User class from HTTP request to > HTTP session: > > private object currentRole extends SessionVar[Box[String]] > > And, finally, I changed 'notProdOrHasAdminRights' LocParam in Boot.scala to > be lazily initialized: > > lazy val notProdOrHasAdminRights = ... > > Vladimir > > 2011/5/9 Richard Hirsch <[email protected]> > >> Just commited your code changes in Boot.scala. Tested locally but >> without the role. >> >> @Vladimir . do you still have your LDAP set-up? Can you try and see if >> it works in productive mode with the "monitoring-admin" role. >> >> D. >> >> On Mon, May 9, 2011 at 10:28 AM, Vladimir Ivanov <[email protected]> >> wrote: >> > Hi Richard, >> > >> > An according to compiler error message you are trying to return >> > List[Boolean] (because User.checkRole("monitoring-admin") returns >> Boolean) >> > instead of List[LocParam] from menuLocParams method. I think following >> > variant is appropriate: >> > >> > >> > val notProdOrHasAdminRights = If(() => (!(Props.productionMode) || >> > User.checkRole("monitoring-admin")), () => RedirectResponse("/")) >> > >> > object logLevel extends LogLevelChanger with Log4jLoggingBackend { >> > override def menuLocParams: List[Loc.AnyLocParam] = >> > List(notProdOrHasAdminRights) >> > } >> > >> > In first line we are creating If case class (which extends LocParam) and >> > takes a test function, () => Boolean, as well as failure message >> function,() >> > => Lift Response, as its arguments. Test function always returns true for >> > non-production modes but in case production mode is active it returns >> true >> > only if current User has "monitoring-admin" role and returns false >> otherwise >> > (in this case current user will be redirected to home page). >> > >> > In second line we are adding LocParam created above to the List of >> > LocParam's. >> > >> > Hope it hepls. >> > >> > Vladimir >> > >> > 2011/5/9 Richard Hirsch <[email protected]> >> > >> >> Hi, >> >> >> >> I want to add this statement in Boot.scala but I get an error: >> >> >> >> object logLevel extends LogLevelChanger with Log4jLoggingBackend { >> >> override def menuLocParams: List[Loc.AnyLocParam] = if >> >> (Props.productionMode) List(User.checkRole("monitoring-admin")) else >> >> Nil >> >> } >> >> >> >> a:125: error: type mismatch; >> >> [WARNING] found : Boolean >> >> [WARNING] required: net.liftweb.sitemap.Loc.AnyLocParam >> >> [WARNING] override def menuLocParams: List[Loc.AnyLocParam] = >> if >> >> (Props >> >> .productionMode) List(User.checkRole("monitoring-admin")) else Nil >> >> [WARNING] >> >> ^ >> >> >> >> Can anyone help me here? Probably something simple but I have no >> idea.... >> >> >> >> R. >> >> >> > >> > >> > >> > -- >> > Best Regards, >> > Vladimir Ivanov >> > >> > > > > -- > Best Regards, > Vladimir Ivanov >
