Beutelevision

by Thomas Beutel

A short blurb on using sfGuardPlugin credentials

(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 the sfGuard permission system are:

  • sf_guard_permission <- represents a permission (credential)
  • sf_guard_group <- represents a group.
  • sf_guard_group_permission <- associates permissions to groups
  • sf_guard_user_group <- associates users to groups

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.

It is possible (but not usually advisable) to associate a user directly with a permission by using the following table:

  • sf_guard_user_permission <- associates users to permissions

Permissions

Permissions typically represent what a user can do, as opposed to representing a “type” of user. Examples of proper permissions are:

  • can_view_items
  • can_edit_items

The following are improper permissions because they represent user types:

  • paying_clients
  • non_paying_clients

Restricting actions via security.yml

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’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.

To require a login for a module, add the following into the module’s config/security.yml file:

 all:
   secure: on

For the most part, permissions are assigned to specific actions. For example:

 listItems:
   credential: can_view_items
 editItem:
   credential: can_edit_items

Using permissions within actions

 public function executeIndex( )
 {
   $user = $this->getUser();
   if($user->has_credential('can_view_items') )
   {
     // get the item list
     ...
   }
   ... and so forth
 }

Meta refresh in Symfony – use view.yml

The easiest way I’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:

<meta http-equiv="Refresh" content="300" />

U.P. 844 videos for April 20, 2009, Sacramento to Oakland

Newcastle Tunnel:
http://www.youtube.com/watch?v=4Z3Nd3CmJso

Yolo Causeway:
http://www.youtube.com/watch?v=W8LZDA5fUUw

Davis:
http://www.youtube.com/watch?v=KFcB4gPwLEg

Elmira Junction:
http://www.youtube.com/watch?v=SLiMwnFIgqY

Martinez:
http://www.youtube.com/watch?v=ysC4fZALNVg

Richmond:
http://www.youtube.com/watch?v=pXd71-Sr9pc

Emeryville:
http://www.youtube.com/watch?v=DFSD7cMUVm0

When Memes Collide – Apple is Expensive vs. Windows is Vulnerable

I always get a kick when the Apple is Expensive meme trotted out as a reason to consider less expensive alternatives. How ironic it is that on the very same day there is news of massive computer infiltration and document loss. The article doesn’t mention the operating system of the computers that were compromised, but I do have a guess.

memes-collide

A look in the mirror – Safari 4

I just installed Safari 4 and the first thing it did was to show me my top sites – the 12 sites that I go to most frequently. My initial reaction was “Weird!” and then “I need to get out more often!”

Here is a fuzzy pic of what I saw:

my top sites in Safari 4

Download is available at http://www.apple.com/safari/

Just a post to test Zemanta

I’m trying out Zemanta using the Firefox plugin and just seeing how it works.

Image representing Zemanta as depicted in Crun...Image via CrunchBase

San Francisco: Much Sun, Little Rain

San Francisco is known for it’s fog, not it’s sunshine, but that’s mostly in the summer months, mid June to the end of August. Right now in January it should be raining, but we have gotten precious little rain this January. As evidence I present you with my solar panel production, which shows a remarkably sunny month:

As you can see, many sunny days, but we need the rain.

For-Profit Do-Gooders

Economist magazine has a great article on for-profit activism and mentions both 1BOG.org and Virgance.

1BOG helped me get a solar panel system last year and I’m am still delighted with how well the whole process went. Thank you again 1BOG and congrats to you and Virgance!

Switching From Halogen to LED Lamps

Jeremiah Owyang switched out a high wattage halogen lamp with an LED version that is only 3W. The LED bulb is expensive, but it will save much more over its life.

Just another example of how to use less energy withiout sacrificing quality of life.

The Model 271

I’m always interested one term can mean different things – polysemy – and now we have the Model 271 in the news. The Model 271 is the type of shoe that was thrown at our President as a sign of disrespect of him and of our country.

Interestingly, the Model 271 is also:

How many Model 271’s do you know of?