wildcard expansion using sql
Your specification does raise some questions, but should be easily possible.

Since % is a wildcard character, and * is not, then you might want to use % as your marker. 

+----+--------------+----------------------+
| id |  role_code   |      permission      |
+----+--------------+----------------------+
|  1 | ADMIN        | app.%                |
|  2 | LOC_ADMIN    | app.location.%       |
|  3 | LOC_READER   | app.location.read    |
|  4 | LOC_APPROVER | app.location.approve |
|  2 | EMP_ADMIN    | app.employee.%       |
|  3 | EMP_READER   | app.employee.read    |
|  4 | EMP_APPROVER | app.employee.approve |
+----+--------------+----------------------+


If so, then you could run code something like this:

SELECT a.role_code, b.permission
FROM permissionstable a
  JOIN permissionstable b on a.permission LIKE b.permission
       and RIGHT(b.permission,1) &lt;&gt; '%'
  ORDER BY b.permission


This does depend on my understanding of the permission strings.