About Drupal 7's permissons I'm new to drupal and when I looked at table {role_permission}, I found that permissions were stored as text string (e.g. "edit own page content"). But when I did a grep in drupal's folder, for some permissions they only appeared in *.test files (In those files, some users with those permissions are created). It seems that some permissions, like "edit own page content", are not used at all, otherwise they should appear somewhere else when they are checked.

Any insights on access control mechanism in drupal would be appreciated. 

Thanks,
ZM
A straight grep for the full string may not find these, but they're used. For instance look in the modules/node/node.module, where you find calls such as:

if (user_access('edit any ' . $type . ' content', $account)
  || (user_access('edit own ' . $type . ' content', $account)
  &amp;&amp; ($account-&gt;uid == $node-&gt;uid))) {


Note that the string is constructed on the fly, where the content type (e.g. page) is inserted into a template to form the string "edit own page content".

These strings are mostly used to call user_access, so to see where and how they're used, you may want to search for this function.