Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I'm not familiar with SocialEngine either, but use Zend Framework a lot. I'll try to give you some hints and hopefully someone else can fill you in more if need be.</p> <p>It looks like SE is using <a href="http://framework.zend.com/manual/en/zend.auth.introduction.html" rel="nofollow">Zend_Auth</a> and <a href="http://framework.zend.com/manual/en/zend.acl.html" rel="nofollow">Zend_Acl</a> in much of the code you just showed.</p> <p>Understanding <code>Zend_Auth</code> is helpful, but all of that part is done and is beyond most of what you want to do. <code>Zend_Acl</code> is what you will probably spend a lot of time reading about.</p> <p>The key concept to understanding the difference between <code>Zend_Auth</code> and <code>Zend_Acl</code> is that <code>Zend_Auth</code> authenticates a user. That is, it checks provided credentials against a database somewhere and says that this person is who they say they are because they supplied a correct identity (e.g. username and password matched). <code>Zend_Acl</code> on the other hand is used to allow or deny access to a given resource based on a role.</p> <p>Put simply, <code>Zend_Auth</code> has nothing to do with <em>what</em> the user is allowed to do, only that they are who they say they are. <code>Zend_Acl</code> is what says that a user has or does not have access to a specific feature or function (resource).</p> <p>I haven't looked at their code to confirm this, but <code>Engine_Api::_()-&gt;user()-&gt;getViewer()-&gt;getIdentity();</code> appears to be pulling the user's identity which at first glance seems to be either <code>null</code> or the user's <code>id</code> from the database. They can use this to tell if a person is logged in or not.</p> <p>Next, they seem to be calling an <a href="http://framework.zend.com/manual/en/zend.controller.actionhelpers.html" rel="nofollow">action helper</a> called <code>requireAuth</code> which can set auth params or check that a user has access. This is a part of Social Engine built on ZF and is not ZF specific so you may need to read more on their documentation about how that helper works.</p> <p>I think this helper is just an indirect way of calling <code>Zend_Acl::isValid()</code> to determine if the role of the user has access to a particular resource. <code>Zend_Acl</code> works quite simply. You can grant or deny access to certain <code>resources</code> based on the <code>role</code> try to access them. By default, access to all resources is denied unless they are specifically allowed.</p> <p>What this plugin probably does is create some new resources, perhaps <code>poll</code> and then controls what users can <code>view</code>, or <code>edit</code> a particular poll.</p> <p>If you read up on <code>Zend_Acl</code>, more of that code should become clear. Then all you have to do is figure out how the plugin stores the roles and resources. I'm guessing there is a standard way to store this in Social Engine and the ACL rules are set up automatically on each request for the given user.</p> <p>Hope that helps some.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload