Re: Ponder: AuthorizeEntity
Ramsey Gurley <[email protected]>
| Newsgroups | gmane.comp.web.webobjects.wonder-disc |
|---|---|
| Message-ID | <[email protected]> |
Well, that's the beauty of ponder. That's why all the rest of it works. All the actions in R2D2W happen through controller buttons and branch delegates.
Unless they are set explicitly, actions are provided via a common delegate (R2DDefaultBranchDelegate) and the actions themselves are determined by an assignment (R2DDefaultBranchChoicesAssignment). Look for the default *ControllerChoices in the rules.
This allows for mind-blowing simplicity in the templates. R2's inspect page template handles inspect, edit, tab, and wizard pages. It does what takes ERD2W three separate templates to do, and it does it in eight lines of component html. So no more rules like shouldShowCreateButton, shouldShowCancelButton, and winding WOConditionals everywhere… all of that goes away and you just assign a list of actions directly like
100 : propertyKey = 'rightControllerAction' => rightControllerChoices = ("_edit", "_delete") [Assignment]
By default, that's done for you by the branch choices assignment. ALL of the control logic scattered across all of the D2W pages in ERDirectToWeb is relocated to a single delegate file in R2. And the root level D2W page shares a single delegate instance with all its nested pages unless you specify a custom delegate for an embedded page config :-)
In the dashboard example, the R2DDefaultBranchChoicesAssignment honors the old isEntityEditable stuff. That's why you'll see it in the user.d2wmodel.
An auth aware assignment lives in ERAuth (ERADefaultAuthorizationAssignment). In the ERAuth rules, it overrides the one in R2. The assignment in ERAuth supplies the actions based on what your CRUDAuthorization says. Maybe you can edit row two, but you can't edit row three. That depends on what you return from canUpdate(eo).
Ramsey
On Dec 20, 2012, at 6:39 PM, James Cicenia wrote:
> OK -
>
> Two Questions:
> 1) In the example you directed me to, there are action icons on the left and right of the list... where the heck are they getting specified?
>
> 2) I have a nice ERXD2WList embedded in my component. Works ok, though can't seem to automagically create the action buttons. I can create my own component, just want to know the magic.
> Anyway, I get an npe error if I display the list with an Inspect component embedded below it.
>
> So, I figure... ah.. I need to Authorize for inspect, etc., so I run wa/AuthorizeUser, set some switches, hit save and then boom:
>
>
> com.webobjects.foundation.NSForwardException [java.lang.NullPointerException] null:java.lang.NullPointerException
> at er.directtoweb.delegates.ERDBranchDelegate.nextPage(ERDBranchDelegate.java:109)
> at er.r2d2w.components.buttons.R2DControllerButton.nextPageFromParent(R2DControllerButton.java:54)
> at er.r2d2w.components.buttons.R2DControllerButton.performAction(R2DControllerButton.java:59)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>
>
> Do I need to set the next page somewhere?
>
> Thanks
> James
> ------------------------------------------------------------------------------
> LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
> Remotely access PCs and mobile devices and provide instant support
> Improve your efficiency, and focus on delivering more value-add services
> Discover what IT Professionals Know. Rescue delivers
> http://p.sf.net/sfu/logmein_12329d2d_______________________________________________
> Wonder-disc mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/wonder-disc
------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d