Merge change 2548 into donut

* changes:
  Fix a bug in AppSecurityPermissions where it wouldn't display permissions used by an app if it uses a shared user id. Remove the else clause and always get the list of requested permissions first before adding the permissions obtained via the shared user id. Also change an if condition and comments for better readability