Thanks - trying it out right now

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
>

Reply via email to