<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Beutelevision &#187; Symfony</title>
	<atom:link href="http://beutelevision.com/blog2/topics/symfony/feed/" rel="self" type="application/rss+xml" />
	<link>http://beutelevision.com/blog2</link>
	<description>by Thomas Beutel</description>
	<lastBuildDate>Fri, 14 Oct 2011 19:13:15 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='beutelevision.com' port='80' path='/blog2/?rsscloud=notify' registerProcedure='' protocol='http-post' />
		<item>
		<title>A short blurb on using sfGuardPlugin credentials</title>
		<link>http://beutelevision.com/blog2/2009/08/20/a-short-blurb-on-using-sfguardplugin-credentials/</link>
		<comments>http://beutelevision.com/blog2/2009/08/20/a-short-blurb-on-using-sfguardplugin-credentials/#comments</comments>
		<pubDate>Fri, 21 Aug 2009 04:23:54 +0000</pubDate>
		<dc:creator>Thomas Beutel</dc:creator>
				<category><![CDATA[Symfony]]></category>

		<guid isPermaLink="false">http://beutelevision.com/blog2/?p=157</guid>
		<description><![CDATA[(Here are a few notes I made to myself about the credential system.)
Credentials are part of the sfGuardPlugin security system for Symfony. For some reason, Symfony also refers to credentials as permissions. As far as I can tell, the two terms are used interchangeably.
sfGuardUser records are stored in the  sf_guard_user  table.
The tables in [...]]]></description>
			<content:encoded><![CDATA[<p>(Here are a few notes I made to myself about the credential system.)</p>
<p>Credentials are part of the <a href="http://www.symfony-project.org/plugins/sfGuardPlugin">sfGuardPlugin</a> security system for Symfony. For some reason, Symfony also refers to credentials as permissions. As far as I can tell, the two terms are used interchangeably.</p>
<p>sfGuardUser records are stored in the <strong> sf_guard_user </strong> table.</p>
<p>The tables in the sfGuard permission system are:</p>
<ul>
<li> <strong> sf_guard_permission </strong> &lt;- represents a permission (credential)</li>
<li> <strong> sf_guard_group </strong> &lt;- represents a group.</li>
<li> <strong> sf_guard_group_permission </strong> &lt;- associates permissions to groups</li>
<li> <strong> sf_guard_user_group </strong> &lt;- associates users to groups</li>
</ul>
<p>Typcially, users belong to one or more groups, and groups are associated to permissions. This is the preferred method, and the above 4 tables are all that is needed to associate permissions to users, via groups.</p>
<p>It is possible (but not usually advisable) to associate a user directly with a permission by using the following table:</p>
<ul>
<li> <strong> sf_guard_user_permission </strong> &lt;- associates users to permissions</li>
</ul>
<h3>Permissions</h3>
<p>Permissions typically represent what a user can do, as opposed to representing a &#8220;type&#8221; of user. Examples of proper permissions are:</p>
<ul>
<li> can_view_items</li>
<li> can_edit_items</li>
</ul>
<p>The following are improper permissions because they represent user types:</p>
<ul>
<li> paying_clients</li>
<li> non_paying_clients</li>
</ul>
<h3>Restricting actions via security.yml</h3>
<p>For credentials to work, the user must be logged in. Since an application is divided into modules, it is conventional to divide modules into those that don&#8217;t require a logged-in user (i.e. fully public pages, such as main/aboutUs or main/termsAndConditions), and those modules that do require a logged-in user.</p>
<p>To require a login for a module, add the following into the module&#8217;s config/security.yml file:</p>
<pre> all:
   secure: on</pre>
<p>For the most part, permissions are assigned to specific actions. For example:</p>
<pre> listItems:
   credential: can_view_items</pre>
<pre> editItem:
   credential: can_edit_items</pre>
<h3>Using permissions within actions</h3>
<pre> public function executeIndex( )
 {
   $user = $this-&gt;getUser();</pre>
<pre>   if($user-&gt;has_credential('can_view_items') )
   {
     // get the item list
     ...
   }</pre>
<pre>   ... and so forth
 }</pre>
]]></content:encoded>
			<wfw:commentRss>http://beutelevision.com/blog2/2009/08/20/a-short-blurb-on-using-sfguardplugin-credentials/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Meta refresh in Symfony &#8211; use view.yml</title>
		<link>http://beutelevision.com/blog2/2009/08/19/meta-refresh-in-symfony-use-viewyml/</link>
		<comments>http://beutelevision.com/blog2/2009/08/19/meta-refresh-in-symfony-use-viewyml/#comments</comments>
		<pubDate>Wed, 19 Aug 2009 18:41:24 +0000</pubDate>
		<dc:creator>Thomas Beutel</dc:creator>
				<category><![CDATA[Symfony]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://beutelevision.com/blog2/?p=153</guid>
		<description><![CDATA[The easiest way I&#8217;ve found to add meta refresh to a specific action in Symfony is to use the view.yml file. Note that I use http_metas, not regular metas.
indexSuccess:
  http_metas:
    refresh: 300
which results in adding the following, as you would expect:
&#60;meta http-equiv="Refresh" content="300" /&#62;
]]></description>
			<content:encoded><![CDATA[<p>The easiest way I&#8217;ve found to add meta refresh to a specific action in Symfony is to use the view.yml file. Note that I use http_metas, not regular metas.</p>
<pre>indexSuccess:
  http_metas:
    refresh: 300</pre>
<p>which results in adding the following, as you would expect:</p>
<pre>&lt;meta http-equiv="Refresh" content="300" /&gt;</pre>
]]></content:encoded>
			<wfw:commentRss>http://beutelevision.com/blog2/2009/08/19/meta-refresh-in-symfony-use-viewyml/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Symfony project menus for Emacs</title>
		<link>http://beutelevision.com/blog2/2008/07/27/symfony-project-menus-for-emacs/</link>
		<comments>http://beutelevision.com/blog2/2008/07/27/symfony-project-menus-for-emacs/#comments</comments>
		<pubDate>Mon, 28 Jul 2008 05:10:17 +0000</pubDate>
		<dc:creator>Thomas Beutel</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Symfony]]></category>

		<guid isPermaLink="false">http://beutelevision.com/blog2/?p=95</guid>
		<description><![CDATA[After reading the Productive Programmer, I was inspired to write a custom script to add Symfony menus to my Emacs editor. After some frustration (I find emacs LISP tough to grok), I finally figured it out. (script is below)
Anyway, here are a couple of pictures showing custom menus for a small project. This allows me [...]]]></description>
			<content:encoded><![CDATA[<p>After reading the Productive Programmer, I was inspired to write a custom script to add Symfony menus to my Emacs editor. After some frustration (I find emacs LISP tough to grok), I finally figured it out. (script is below)</p>
<p>Anyway, here are a couple of pictures showing custom menus for a small project. This allows me to find and load module templates, action files, and models quickly and easily.</p>
<p>Â </p>
<p><a href="http://beutelevision.com/blog2/wp-content/uploads/2008/07/picture-19.gif"><img class="alignnone size-medium wp-image-94" title="picture-19" src="http://beutelevision.com/blog2/wp-content/uploads/2008/07/picture-19.gif" alt="symfonu modules in an emacs menu" width="300" height="151" /></a></p>
<p>Â </p>
<p><a href="http://beutelevision.com/blog2/wp-content/uploads/2008/07/picture-20.gif"><img class="alignnone size-medium wp-image-93" title="picture-20" src="http://beutelevision.com/blog2/wp-content/uploads/2008/07/picture-20.gif" alt="lib/models in an emacs menu" width="300" height="263" /></a></p>
<p>OK, I didn&#8217;t write the script in elisp. Instead, I use perl to generate the elisp code. To create the elisp code, I run this script at the root of the Symfony project.</p>
<div class="codeblock"><code>#!/usr/bin/perl<br />
$dir = `pwd`;<br />
chomp $dir;Â Â Â </p>
<p>print qq{<br />
;; menu.el - quick access menus for emacs editor<br />
;; *** auto generated by bin/symenu ***<br />
;; To use this menu, load into buffer and then ESC-X eval-buffer<br />
;; T. Beutel</p>
<p>(defvar my-menu nil "my menu")<br />
};</p>
<p>my $menus = qq{<br />
Â (easy-menu-define my-menu global-map "My own menu"<br />
Â '("Modules"<br />
};</p>
<p>my $count = 0;</p>
<p>while(){<br />
Â  ($module) = (m/ \/ ([^\/]+) \z /xms);<br />
Â  $count++;<br />
Â  print qq{<br />
(defun $module-actions ()<br />
Â (interactive)<br />
Â  (let (mybuffer)<br />
Â    (setq mybuffer (find-file "$dir/apps/frontend/modules/$module/actions/actions.class.php"))<br />
Â )<br />
)<br />
};</p>
<p>$menus .= qq{<br />
Â ("$module"<br />
Â ["actions" $module-actions t]<br />
};</p>
<p>while(){<br />
Â    ($template,$success,$tmpl2) = (m/ \/ (?: ([^\/]+) (Success) | ([^\/]+) ) \.php \z /xms);<br />
Â    $template ||= $tmpl2;</p>
<p>$count++;<br />
Â    print qq{<br />
(defun $module-$template ()<br />
Â (interactive)<br />
Â  (let (mybuffer)<br />
Â    (setq mybuffer (find-file "$dir/apps/frontend/modules/$module/templates/$template$success.php"))<br />
Â )<br />
)<br />
};</p>
<p>$menus .= qq{<br />
Â ["$template" $module-$template t]<br />
};</p>
<p>}</p>
<p>$menus .= ")\n";</p>
<p>}</p>
<p>print $menus . "))\n";</p>
<p># Models</p>
<p>my $menus = qq{<br />
Â (easy-menu-define my-menu global-map "My own menu"<br />
Â '("Models"<br />
};</p>
<p>my $count = 0;</p>
<p>while(<br />
){<br />
Â  ($model) = (m/ \/ ([^\/]+) \.php \z /xms);</p>
<p>$count++;<br />
Â  print qq{<br />
(defun model-$model ()<br />
Â (interactive)<br />
Â  (let (mybuffer)<br />
Â    (setq mybuffer (find-file "$dir/lib/model/$model.php"))<br />
Â )<br />
)<br />
};</p>
<p>$menus .= qq{<br />
Â ["$model" model-$model t]<br />
};</p>
<p>}</p>
<p></code><code>print $menus . "))\n";<br />
</code></p>
</div>
<p>Update: After I wrote my implementation, I found this pure elisp implementation that creates an even better symfony navigation: <a href="http://svn.tracfort.jp/svn/dino-symfony/emacs-symfony/emacs-symfony/symfony-navigation.el">http://svn.tracfort.jp/svn/dino-symfony/emacs-symfony/emacs-symfony/symfony-navigation.el</a></p>
]]></content:encoded>
			<wfw:commentRss>http://beutelevision.com/blog2/2008/07/27/symfony-project-menus-for-emacs/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

