Hello Brenton,
I think these questions may influence your decision...
1. What about admin access? (Typically god like access, irrelevant of
permissions)
1a. What about the admin faking it as another user in attempt to reproduce the
bug?
2. What about test code? Should your test code test both the model
functionality and your security model?
3. Should other people be able to use these models without the security?
3a. Say you need to write some code to audit your models against your database.
3b. Or you want to obtain some statistical data.
3c. What about 3rd party access? Say you want to allow client X to view some
data?
You can also possibly do it both ways, I haven't really thought this out, but
this may be possible.
class MyModel {
public function getTitle();
}
class MyModel_Secure {
private $MyModel;
public function __construct($acl, $args) {
$this->MyModel = new MyModel($args);
}
public function getTitle() {
if ( $acl->saysYes ) return $myModel->getTitle();
throw new Exception("opps");
}
}
This would handle both of your concerns at the same time. You get the benefits
of an independent model layer, but you also get the security too. At twice the
model count...
-daniel
Saturday, June 20, 2009, 7:30:19 PM, you wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> Hi,
> I am working on the architecture of a new ZF application and have am
> questioning which module is responsible for assigning permissions to the
> ACL.
> I have an Auth module that manages the ACL for the application. The Auth
> module exposes an Authorization service, which is used by services of
> other modules to check the ACL. Does this seem like a good structure?
> But the main issue I'm seeking advice on is where the permissions should
> be set. The Auth module doesn't know about the resources of the other
> modules, and the other modules don't know about the roles defined in the
> Auth module. So should the application (aka. default module), which
> knows about both, assign the permissions? Does this violate the idea
> that permissions are business logic and thus should be defined in the model?
> Any insight appreciated, thanks.
--
Best regards,
Daniel mailto:[email protected]