Maybe that's a pretty good solution. Even if the admin-mode was in
another file I couldn't really stop 'attackers' from loading it. I
think that it's always possible to see the admin interface if you want
to (remember: you can open JS code in browser and live-modify it). I
don't think it's important to hide the UI, do you?
It's much much much more important that the guy who modifies it can't
modify the data on the server :)
For my page there will be just 1 button more per widget (-> leads to
edit/delete mode). Sure I could load the edit/delete mode right after
someone locks in, but is it worth it for maybe 5kb?
Anyways thank you. I'll try you approach soon
On 3 Okt., 04:36, "Aidan O'Kelly" <aida...@gmail.com> wrote:
> On Sun, Oct 2, 2011 at 3:06 PM, benneq <benjamin_ma...@lavabit.com> wrote:
>
> > A working solution would be:
> > have a single presenter and a single view. And the presenter tells the
> > display using a boolean which UI to display. But I expect it to
> > produce very ugly code. Everywhere:
> > # if(loggedIn == true)
> > # show this;
> > #
> > # show UI for both;
>
> If you don't mind having the admin widgets/elements exist in all pages, but
> be hidden then this, pretty much.
>
> In your view:
> showAdminUi(boolean isAdmin) {
> adminButtonA.setVisible(isAdmin);
> adminTextBoxB.setVisible(isAdmin);
> adminButtonY.setVisible(isAdmin);
>
> }
>
> Call it from your presenter. And hide the widgets by default (just call
> showAdminUi(false) in your views constructor)
> You could further improve this method using CSS and/or searching for the
> widgets/elements to be toggled. You can also group things inside Panel's and
> just hide/show them.
>
> There are certainly other approaches, but no need to overcomplicate it for a
> handful of widgets on each page.
--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
No comments:
Post a Comment