Re: Modularity - Users and UserProfile controllers

Shad Laws <shad-xpYdmXCiSuZWk0Htik3J/[email protected]> Sat, 11 May 2013 23:26:15 +0200
Newsgroups gmane.comp.web.gallery.devel
Message-ID <CA+z51A4077QOJYDqgDdP2sZT-0JnQ0B56_889L1c5q45o4ggrw@mail.gmail.com>
--===============2153721015302608808==
Content-Type: multipart/alternative; boundary=047d7b343c66259d4004dc77f0fe

--047d7b343c66259d4004dc77f0fe
Content-Type: text/plain; charset=UTF-8

Hmm... on second thought, the approach I proposed has a problem: it
*expects* that Gallery should be able to change the email, password, etc.,
which may not always be the case for an identity provider.  Using a module
event is probably a more flexible approach...

Take care,
Shad


On 11 May 2013 19:31, Shad Laws <shad-xpYdmXCiSuZWk0Htik3J/[email protected]> wrote:

> Hey everyone,
>
> I just finished converting the user/group-related controllers and forms
> over to Formo, and found that the view used in
> Controller_UserProfile::action_show() (gallery module) has URLs to things
> in Controller_Users (user module)... which seems like a breach of
> modularity.
>
> Right now, we have:
> [user module]
> class Controller_Users extends User_Controller_Users {}
> class User_Controller_Users {
>   public function action_edit();
>   public function action_change_email();
>   public function action_change_password();
> }
> [gallery module]
> class Controller_UserProfile extends Gallery_Controller_UserProfile {}
> class Gallery_Controller_UserProfile {
>   public function action_show();
>   public function action_contact();
> }
>
> My thought:
> - in the gallery module, change Controller_UserProfile to make it an
> abstract class in IdentityProvider.
> - add three abstract action functions that reflect the three links it
> wants.
> - in the user module, make Controller_UserProfile extend the abstract
> class in Gallery.
>
> Then, we'd have something like:
> [user module]
> class Controller_Users extends User_Controller_Users {}
> class User_Controller_Users extends IdentityProvider_Controller_Users {
>   public function action_edit();
>   public function action_change_email();
>   public function action_change_password();
> }
> [gallery module]
> abstract class IdentityProvider_Controller_Users extends
> Gallery_IdentityProvider_Controller_Users {}
> abstract class Gallery_IdentityProvider_Controller_Users {
>   public function action_show();
>   public function action_contact();
>   abstract public function action_edit();
>   abstract public function action_change_email();
>   abstract public function action_change_password();
> }
>
> Thoughts?
>
> Take care,
> Shad
>

--047d7b343c66259d4004dc77f0fe
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Hmm... on second thought, the approach I proposed has a pr=
oblem: it *expects* that Gallery should be able to change the email, passwo=
rd, etc., which may not always be the case for an identity provider. =C2=A0=
Using a module event is probably a more flexible approach...<div class=3D"g=
mail_extra">

<br></div><div class=3D"gmail_extra">Take care,</div><div class=3D"gmail_ex=
tra">Shad</div><div class=3D"gmail_extra"><br><br><div class=3D"gmail_quote=
">On 11 May 2013 19:31, Shad Laws <span dir=3D"ltr">&lt;<a href=3D"mailto:s=
had-xpYdmXCiSuZWk0Htik3J/[email protected]" target=3D"_blank" onclick=3D"window.open(&#39;https://mai=
l.google.com/mail/?view=3Dcm&amp;tf=3D1&amp;to=3Dshad-xpYdmXCiSuZWk0Htik3J/[email protected]&amp;cc=
=3D&amp;bcc=3D&amp;su=3D&amp;body=3D&#39;,&#39;_blank&#39;);return false;">=
shad-xpYdmXCiSuZWk0Htik3J/[email protected]</a>&gt;</span> wrote:<br>

<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex"><div dir=3D"ltr">Hey everyone,<div><br></div=
><div>I just finished converting the user/group-related controllers and for=
ms over to Formo, and found that the view used in Controller_UserProfile::a=
ction_show() (gallery module) has URLs to things in Controller_Users (user =
module)... which seems like a breach of modularity.</div>


<div><br></div><div>Right now, we have:</div><div><font face=3D"courier new=
, monospace">[user module]<br></font></div><div><font face=3D"courier new, =
monospace">class Controller_Users extends User_Controller_Users {}</font></=
div>


<div><font face=3D"courier new, monospace">class User_Controller_Users {<br=
></font></div><div><div><font face=3D"courier new, monospace">=C2=A0 public=
 function action_edit();</font></div><div><font face=3D"courier new, monosp=
ace">=C2=A0 public function action_change_email();</font></div>


<div><font face=3D"courier new, monospace">=C2=A0 public function action_ch=
ange_password();</font></div><div><font face=3D"courier new, monospace">}</=
font></div></div><div><font face=3D"courier new, monospace">[gallery module=
]</font></div>


<div><font face=3D"courier new, monospace">class Controller_UserProfile ext=
ends=C2=A0Gallery_Controller_UserProfile=C2=A0{}</font></div><div><font fac=
e=3D"courier new, monospace">class Gallery_Controller_UserProfile {<br></fo=
nt></div>


<div><font face=3D"courier new, monospace">=C2=A0 public function action_sh=
ow();</font></div><div><font face=3D"courier new, monospace">=C2=A0 public =
function action_contact();</font></div><div><font face=3D"courier new, mono=
space">}</font></div>


<div><br></div><div>My thought:<br></div><div>- in the gallery module, chan=
ge Controller_UserProfile to make it an abstract class in IdentityProvider.=
</div><div>- add three abstract action functions that reflect the three lin=
ks it wants.</div>


<div>- in the user module, make Controller_UserProfile extend the abstract =
class in Gallery.</div><div><br></div><div>Then, we&#39;d have something li=
ke:</div><div><div><div><font face=3D"courier new, monospace">[user module]=
<br>


</font></div><div><font face=3D"courier new, monospace">class Controller_Us=
ers extends User_Controller_Users {}</font></div><div><font face=3D"courier=
 new, monospace">class User_Controller_Users extends IdentityProvider_Contr=
oller_Users {</font></div>


<div><div><font face=3D"courier new, monospace">=C2=A0 public function acti=
on_edit();</font></div><div><font face=3D"courier new, monospace">=C2=A0 pu=
blic function action_change_email();</font></div><div><font face=3D"courier=
 new, monospace">=C2=A0 public function action_change_password();</font></d=
iv>


<div><font face=3D"courier new, monospace">}</font></div></div></div><div><=
font face=3D"courier new, monospace">[gallery module]</font></div><div><fon=
t face=3D"courier new, monospace">abstract class IdentityProvider_Controlle=
r_Users extends Gallery_IdentityProvider_Controller_Users {}</font></div>


<div><font face=3D"courier new, monospace">abstract class Gallery_IdentityP=
rovider_Controller_Users=C2=A0{<br></font></div><div><font face=3D"courier =
new, monospace">=C2=A0 public function action_show();</font></div><div><fon=
t face=3D"courier new, monospace">=C2=A0 public function action_contact();<=
/font></div>


<div><font face=3D"courier new, monospace">=C2=A0 abstract public function =
action_edit();</font></div><div><font face=3D"courier new, monospace">=C2=
=A0=C2=A0abstract=C2=A0public function action_change_email();</font></div><=
div><font face=3D"courier new, monospace">=C2=A0=C2=A0abstract=C2=A0public =
function action_change_password();</font></div>


<div><font face=3D"courier new, monospace">}</font></div><div><br></div><di=
v>Thoughts?</div><div><br></div><div>Take care,<br></div><div>Shad</div></d=
iv></div>
</blockquote></div><br></div></div>

--047d7b343c66259d4004dc77f0fe--


--===============2153721015302608808==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and 
their applications. This 200-page book is written by three acclaimed 
leaders in the field. The early access version is available now. 
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
--===============2153721015302608808==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

__[ g a l l e r y - d e v e l ]_________________________

[ list info/archive --> http://gallery.sf.net/lists.php ]
[ gallery info/FAQ/download --> http://gallery.sf.net ]
--===============2153721015302608808==--