Views Private Access allows you to define a view's access as private, which means that the view will be displayed only if the first argument equals to the current user ID. There is also a global permission for admins.

This module exists from users at issue https://drupal.org/node/305250. The code there was easily accessible. I took it upon myself to get it up to D7, since I use it frequently, and create a project for it in the community. I thought others would find it useful, as well.

https://drupal.org/sandbox/raycascella/2227635

git clone --branch 7.x-1.x http://git.drupal.org/sandbox/RayCascella/2227635.git views_private_access

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

PA robot’s picture

Status: Needs review » Needs work

Git clone failed for http://git.drupal.org/sandbox/raycascella/2227635.git while invoking http://pareview.sh/pareview/httpgitdrupalorgsandboxraycascella2227635git

Git clone failed. Aborting.

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.

RayCascella’s picture

Issue summary: View changes
Status: Needs work » Needs review
RayCascella’s picture

Status: Needs review » Needs work
briganzia’s picture

Hi,
No documentation for installing the module. I think you should include a README.txt following this schema: https://drupal.org/node/2181737

RayCascella’s picture

Thanks for the tip! Just cleaned up some code and threw in a README.txt. It's a pretty simple module, but let me know if you think the readme needs some expansion.

RayCascella’s picture

Issue summary: View changes
Status: Needs work » Needs review
briganzia’s picture

Hi, I think you should follow a README template as in https://drupal.org/node/2181737.
I've installed the module, I can see the "private" option under page access permission but it can't be saved.
Could you give me some sample of use?
I think this module should be put in "needs work" status and you could specify which tasks you need.
Probably I didn't understand how this module should work...

RayCascella’s picture

Hi briganzia,

I'm not sure I follow, I've never seen an error when changing the access check. Are you unable to save the view or click Update after changing the access check? Did you get an error message?

After you select Private as your access type, and click Apply, you may see an empty form, since there are no options, but at that point it should have updated the view, and then allow you to click continue. After that, you can save the view in full, to see the result.

I'll be removing the empty form next commit, after also updating the README.txt. Once I get done work, alittle later today, I'll attach an export of a view using the plugin for reference.

briganzia’s picture

Hi Ray,
I created a new views (page and block display) but I dont see empty form after applying Private type. It shows the views main interface but nothing saved. No errors message.
I tested the module on another Drupal installation and the behaviour is the same.

RayCascella’s picture

Hi briganzia,

Finally, was able to replicate your error! I've fixed the bug and updated the README.txt. Newest code should do it. Hopefully, it all makes sense now and you're good to go.

Thank you for helping me test this bad boy out and get it going.

Raymond

briganzia’s picture

Hi,
now I'm able to run it, it's fine!
:)

RayCascella’s picture

Status: Needs review » Needs work
RayCascella’s picture

Status: Needs work » Needs review
david_garcia’s picture

I could not find a single thing to complain about, the module is small and impecably implemented.

RayCascella’s picture

Status: Needs review » Reviewed & tested by the community
RayCascella’s picture

Status: Reviewed & tested by the community » Needs review

I've had this waiting for a few months, and I suppose, needs another review? Unfortunately, I've not had time to review other applications, I was hoping my request would move up the queue organically, but it seems to have stalled? There have been two reviews so far, just wondering what I can do to bump it up the queue. Thanks

er.pushpinderrana’s picture

Status: Needs review » Needs work
FileSize
6.59 KB

@RayCascella o, thankyou for your contribution.

Automated Review

Best practice issues identified by pareview.sh / drupalcs / coder. Yes, http://pareview.sh/pareview/httpgitdrupalorgsandboxraycascella2227635git reported number of issues that need to be fix.

Manual Review

Individual user account
Yes: Follows the guidelines for individual user accounts.
No duplication
Yes: Does not cause module duplication and fragmentation.
Master Branch
Yes: Follows the guidelines for master branch.
Licensing
Yes: Follows the licensing requirements
3rd party code
Yes: Follows the guidelines for 3rd party code.
README.txt/README.md
Yes: Follows the guidelines for in-project documentation and the README Template.
Code long/complex enough for review
(+) Not Sure: Follows the guidelines for project length and complexity. Since this module contains more than 120 lines of code but I still feel after excluding comments it might come down 120 lines rest admin would decide, yet not adding Single Project Promote Tag.
Secure code
Yes. If "no", list security issues identified.
Coding style & Drupal API usage
  1. (*) views_private_access_check_access(): If uid not exist in url, it produces following warning that need to be fix.

    Notice

    I tested this module functionality, it works as intended but If user forcefully replaced user uid with 0(anonymous user) then it displays requested views data that looks wired, even anonymous user don't have permission for Access all private views. You should correct following code where you are directly checking $arg[0] == $account->uid .

    function views_private_access_check_access($arg, $account = NULL) {
      global $user;
      $account = isset($account) ? $account : $user;
      if ($account->uid == 1 || $arg[0] == $account->uid || user_access('access all private views', $account)) {
        return TRUE;
      }
      else {
        return FALSE;
      }
    }
    
  2. Can you do some enhancement in your view part, currently if user choose private option then it should be compulsory to keep first placeholder for user uid in path because without this option It is not going to be work at all.

Other than first point, rest looks good to me. Inline comments and doc are very well managed. Good Job!

The starred items (*) are fairly big issues and warrant going back to Needs Work. Items marked with a plus sign (+) are important and should be addressed before a stable project release. The rest of the comments in the code walkthrough are recommendations.

As I am not a git administrator, so I would recommend you, please help to review other project applications to get a review bonus. This will put you on the high priority list, then git administrators will take a look at your project right away :-)

Thanks again for your hard work!

RayCascella’s picture

Thanks for your thorough feedback, er.pushpinderrana! I'll take look at the code and fix things up.

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.

RayCascella’s picture

Status: Closed (won't fix) » Needs review
Swarnendu-Dutta’s picture

Hi Raymond,

Thanks for your contribution.

Please update git clone url to git clone --branch 7.x-1.x http://git.drupal.org/sandbox/RayCascella/2227635.git views_private_access

Assigning this to myself. Will do a manual review shortly.

Swarnendu-Dutta’s picture

Assigned: Unassigned » Swarnendu-Dutta
naveenvalecha’s picture

Issue summary: View changes

Updated the git clone url.

RayCascella’s picture

Thanks for the assist naveenvalecha , didn't realize it needed the folder name tacked on to the end.

davidgrayston’s picture

Status: Needs review » Needs work

The automated review has highlighted a few issues with the 7.x-1.x branch: http://pareview.sh/pareview/httpgitdrupalorgsandboxraycascella2227635git...

  • PHP Parse error: syntax error, unexpected '&&' (T_BOOLEAN_AND), expecting ',' or ')' in ./views_private_access.module on line 93
  • Errors parsing ./views_private_access.module
    Coder Sniffer has found some issues with your code (please check the Drupal coding standards). See attachment.
  • No automated test cases were found, did you consider writing Simpletests or PHPUnit tests? This is not a requirement but encouraged for professional software development.

The first error meant the module couldn't be enabled

There's also a warning to remove/rename the dev branch: remotes/origin/7.x-1.x-dev

davidgrayston’s picture

Fatal error prevented module being enabled:
$path_uid = isset($arg[0] && is_numeric($arg[0]) ? $arg[0] : NULL;

This should probably be:
$path_uid = isset($arg[0]) && is_numeric($arg[0]) ? $arg[0] : NULL;

views_private_access_help() is missing Implements hook_help(). 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.