Description :
Add permissions to edit their own ('User can edit their own profile') and all user profiles ('User can edit all profiles'.).
'User can edit all profiles' depends on 'View user profiles' permission.

Project Link :
https://drupal.org/sandbox/porfenovich/2232743

Git Link :
http://git.drupal.org/sandbox/porfenovich/2232743.git

CommentFileSizeAuthor
#1 access_profile_edit.png20.27 KBporfenovich

Comments

porfenovich’s picture

StatusFileSize
new20.27 KB
PA robot’s picture

We are currently quite busy with all the project applications and we prefer projects with a review bonus. Please help reviewing and put yourself on the high priority list, then we will take a look at your project right away :-)

Also, you should get your friends, colleagues or other community members involved to review this application. Let them go through the review checklist and post a comment that sets this issue to "needs work" (they found some problems with the project) or "reviewed & tested by the community" (they found no major flaws).

I'm a robot and this is an automated message from Project Applications Scraper.

denison’s picture

hello,

The module is working properly. But can you describe more about the
use case that you needed to resolve this module.

Could improve read.me file?
Follow the link https://drupal.org/node/2181737 documentation.

Thank you for your contribution.

porfenovich’s picture

Issue summary: View changes
porfenovich’s picture

Thanks,

I have improved the readme.txt file.

gbisht’s picture

Status: Needs review » Needs work

Hi porfenovich,

I installed your module in fresh drupal installation and created a new role "Author". Then enabled your module and gave permission to "Author" role for both "User can edit their own profile" and "User can edit all profiles". But when I logged in with one user with role "Author" then I'm not able to edit other user profile with "Author" role. I tried all combination in permissions but it worked only when I gave permission to "Authenticated User". I don't understand why it didn't work for me, please tell if I'm doing something wrong.
One more issue I found that when user edit its own profile then in title you can see user's username but at the time of editing other user's profile it shows "Home" as title, I think there also it should show username.

porfenovich’s picture

Issue summary: View changes
porfenovich’s picture

Status: Needs work » Needs review

Thanks,

I have improved the code and readme.txt file. Now 'User can edit all profiles' depends on 'View user profiles' permission. I think it will be correct.

eft’s picture

I think you have some issues with your logic in your access callback, which is the core of your module.

Try this instead:

/**
 * Access callback for Edit user profiles.
 */
function access_profile_edit_permission_access($account) {
  global $user;

  if (user_access('administer users')){
    return TRUE;
  }
  elseif (user_access('edit all profiles')) {
    return TRUE;
  }
  elseif (user_access('edit own profile') && $user->uid == $account->uid) {
    return TRUE;
  }
  else {
    return FALSE;
  }
}
  • It ensures that any user with 'administer users' also has implicit permission to edit all profiles
  • It progresses from 'most permissive' to 'least permissive'. In your callback you test 'edit own profile' first so someone with 'edit all profiles' will not be able to edit their own profile
  • It removes the check for 'access user profiles' because AFAIK the user module is going to test for this before it even gets to your callback

A few other general comments:

  1. Your git branch should follow the Drupal convention and use 7.x-1.x instead of 7.x.1.x
  2. As another reviewer noted, it would be helpful to provide some use case examples in support of your module
  3. It would also be worth providing a comparison to similar contrib modules to demonstrate that your module fills a niche that is not already addressed with another module

Hope this helps

eft’s picture

Status: Needs review » Needs work

Changing project status, based on my previous comment.

PA robot’s picture

Status: Needs work » Closed (won't fix)

Closing due to lack of activity. If you are still working on this application, you should fix all known problems and then set the status to "Needs review". (See also the project application workflow).

I'm a robot and this is an automated message from Project Applications Scraper.