2010年3月1日星期一

[fw-mvc] Changing get parameters to controller/action/param/value/param/value

Hello, I have a search form on my site, and I want the parameters to be changed from:

controller/action/param=value&param=value

to:

controller/action/param/value/param/value

How would I change this behavior when a user submits a get form? CodeIgniter has this behavior by default, but I don't want to hack through the framework unless there isn't a simpler solution out there. 
 
Thanks,
 
-Andy

Re: [fw-auth] Re: ACL... but completely different

Instead of passing in the user id and blog post id, you want to pass in the user instance and blog instance. Then your assertion would take care of reading the IDs from the objects and determine if the user can edit it:

$acl->isAllowed($userObject, $blogObject, 'edit');

Your assertion might look like this:

if ($userObject->getId() == $blogObject->getAuthor()->getId()) {
    return true;
} else {
    return false;
}

This would also give you more flexibility in your assertions. Let's say you have a business rule where published blog entries can not be edited (even by the author). You would just need to update your assertion:

if ($blogObject->isPublished()) {
    return false;
}

if ($userObject->getId() == $blogObject->getAuthor()->getId()) {
    return true;
} else {
    return false;
}


--
Hector


On Mon, Mar 1, 2010 at 10:08 AM, George Secrieru <george.secrieru@gmail.com> wrote:
I can't see a use for that. As the idea of the assertion is to return true or false, you could just implement all the verifying needed in control structures if you need extra checks. This way, you could implement only one assertion.

Regards,
George


On Thu, Feb 4, 2010 at 5:36 PM, Laura Dean <ldean@saleamp.com> wrote:

I just extended Zend_Acl and added a getAssert() method so that I can see
which assertion is attached to which resource.  Next question... it looks
like only one assertion can be associated per resource/privilege, is that
correct?  It seems like it would be useful to support multiple assertions.
--
View this message in context: http://n4.nabble.com/ACL-but-completely-different-tp1299970p1469388.html
Sent from the Zend Auth mailing list archive at Nabble.com.




--
George Secrieru
51 - 9725 39 29

Re: [fw-auth] Re: ACL... but completely different

You could save this type of data at Zend_Auth's storage and read inside the assertion class.

Like:

<?php
class Baz_Acl_Assert_Foo implements Zend_Acl_Assert_Interface
 {
    public function assert(Zend_Acl $acl,
                           Zend_Acl_Role_Interface $role = null,
                           Zend_Acl_Resource_Interface $resource = null,
                           $privilege = null)
    {
        return $this->hasAccess();
    }
   
    protected function_hasAccess()
    {
        $front = Zend_Controller_Front::getInstance();
        $request = $front->getRequest();

        $auth = Zend_Auth::getInstance();   
       
        $foo = $auth->getStorage()->read()->usu_id;
       
        if($foo == 'Owner'){
            return true;
        }
        return false;
    }

 }

Regards,
George

On Mon, Mar 1, 2010 at 3:05 PM, Laura Dean <ldean@saleamp.com> wrote:

I must be missing something with the assertions.  The example given was just
testing an IP address which can be determined by a global variable, but if I
need to test if the user owns the blog post, surely I must pass in the user
id and the id of the blog post?  Is there some way to pass parameters to the
assertions?  I was thinking something like this would be convenient:

$acl->isAllowed('role', 'resource', 'privilege', $params);

Or am I supposed to extend Zend_Acl_Resource so that I can set the id here?
--
View this message in context: http://n4.nabble.com/ACL-but-completely-different-tp1299970p1573971.html
Sent from the Zend Auth mailing list archive at Nabble.com.




--
George Secrieru
51 - 9725 39 29

Re: [fw-auth] Re: ACL... but completely different

I can't see a use for that. As the idea of the assertion is to return true or false, you could just implement all the verifying needed in control structures if you need extra checks. This way, you could implement only one assertion.

Regards,
George

On Thu, Feb 4, 2010 at 5:36 PM, Laura Dean <ldean@saleamp.com> wrote:

I just extended Zend_Acl and added a getAssert() method so that I can see
which assertion is attached to which resource.  Next question... it looks
like only one assertion can be associated per resource/privilege, is that
correct?  It seems like it would be useful to support multiple assertions.
--
View this message in context: http://n4.nabble.com/ACL-but-completely-different-tp1299970p1469388.html
Sent from the Zend Auth mailing list archive at Nabble.com.




--
George Secrieru
51 - 9725 39 29

[fw-auth] Re: ACL... but completely different

I must be missing something with the assertions. The example given was just
testing an IP address which can be determined by a global variable, but if I
need to test if the user owns the blog post, surely I must pass in the user
id and the id of the blog post? Is there some way to pass parameters to the
assertions? I was thinking something like this would be convenient:

$acl->isAllowed('role', 'resource', 'privilege', $params);

Or am I supposed to extend Zend_Acl_Resource so that I can set the id here?
--
View this message in context: http://n4.nabble.com/ACL-but-completely-different-tp1299970p1573971.html
Sent from the Zend Auth mailing list archive at Nabble.com.

[fw-webservices] Generating end user documentation for SOAP services.

Hi.

I've got a webservice using Zend_Soap_Server (along with AutoDiscover
and WSDL from the Zend Framework).

I used DocBlocks to describe my code and I can happily produce the
developer level documentation for the classes (55 classes dealing with
authentication, supplying data and versioning).

I would like to be able to produce end-user documentation which is
pretty limited in scope as it only needs to document the calls/methods
that they can make via SOAP and not to show the internal workings
(which is what my developer level documentation is showing). I'd like
to be able to generate the documentation automatically (like
phpdocumentor).

So, can I build documentation from a WSDL file?

The WSDL file contains <documentation> tags. I'd like to be able to
add documentation to the complex types (not sure that is possible via
WSDL).

Ideas, suggestions, links, experience, etc. would be gratefully received.


Regards,

Richard Quadling.

--
-----
Richard Quadling
"Standing on the shoulders of some very clever giants!"
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling

RE: [fw-mvc] Generated urls to map to controllers and actions

Hi,

Thanks for the reply.

The biggest problem with this solution, is the fact that I won't be able to use the url view helper (assembling my url).

Should I create a new route class extending Zend_Controller_Router_Route_Abstract, and add that one to the router of the frontcontroller?

$this->bootstrap('frontController');
$fc = $this->frontController;
$router = $fc->getRouter();
$route = new My_Route(...);
$router->addRoute('cms', $route);

This way, my default route should still be working, and the 'normal' router is used.

Is this the correct way?

Regards,
Jachim Coudenys

-----Oorspronkelijk bericht-----
Van: Viktor Grandgeorg [mailto:info@intelligibel.de]
Verzonden: vrijdag 26 februari 2010 20:55
Aan: fw-mvc@lists.zend.com
Onderwerp: RE: [fw-mvc] Generated urls to map to controllers and actions

Hi,

I think a good start could be to write a Controller Plugin, something like:

<?php
class Controllers_Plugin_Maproutes extends Zend_Controller_Plugin_Abstract
{
public function preDispatch(Zend_Controller_Request_Abstract $request)
{
Zend_Registry::set('zfRequestController', $request->getControllerName());
Zend_Registry::set('zfRequestAction', $request->getActionName());

$oYourMappingTable = new MappingTable();

if($oYourMappingTable->isMappable($request->getControllerName(), $request->getActionName())) {
$request->setControllerName($oYourMappingTable->getMappedControllerName());
$request->setActionName($oYourMappingTable->setMappedActionName());
} else {
// route to error (or pass the request to a next route...)
$request->setControllerName('error');
$request->setActionName('error');
}
}
}

Regards, Viktor

> -----Original Message-----
> From: Jachim Coudenys [mailto:Jachim.Coudenys@guideline.be]
> Sent: Friday, February 26, 2010 8:55 AM
> To: fw-mvc@lists.zend.com
> Subject: [fw-mvc] Generated urls to map to controllers and actions
>
> Hi,
>
> I'm searching for a correct solution for a routing problem
> I'm struggling with for quite a while now, but I can't
> extract the answer out of the Zend_Controller_Router manual page.
>
> Our system produces friendly url's lik this:
> - language/catagory/category/product
> - language/catagory
> - language/category/product/article
> - language/section/page/subpage
> - etc...
>
> This can be quite long/deep (the customer organizes its
> tree), but I can map a controller/action/id/etc... to every url.
>
> I've tried to subclass the router, but that overrides the
> complete routing section.
>
> I want to be able to check for a record in my mapping table
> (url to controller/etc...), but pass the request to a next
> route (with translated segments and the 'normal' route e.g.)
> when no mapping could be done.
>
> The nicest thing would be if I could use assemble() to create
> a url base don the mapping table.
>
> Do I need a router, or a route and how would I get started?
>
> Thanks in advance!
>
> Regards,
> Jachim Coudenys
>


This email was Anti Virus scanned.