This is a subissue of #1391216: Views integration for the 6.x-2.x and 7.x-1.x version

Problem/Motivation

When displaying a View of addresses, it would be nice to be able to filter out addresses the user is not supposed to see.

Proposed resolution

There should be three Views filters implemented to filter on address access:

  • A filter for if the address may be viewed.
  • A filter for if the address may be edited.
  • A filter for if the address may be deleted.

These three filters should be connected with the permissions class (UcAddressesPermissions).

Because checking address access would require a full address object, it should leave out support for pager, as checking access for all addresses could become a real performance hit.

Remaining tasks

  • Implement the three access filters.

User interface changes

None directly, but site builders will get an option in Views to filter out addresses the user should not have access to.

API changes

None.

A patch will follow.

Files: 
CommentFileSizeAuthor
#9 uc_addresses7-views-access-filters-1900150-9.patch4.63 KBMegaChriz
PASSED: [[SimpleTest]]: [MySQL] 3,387 pass(es).
[ View ]
#7 uc_addresses6-views-access-filters-1900150-7.patch18.46 KBMegaChriz
PASSED: [[SimpleTest]]: [MySQL] 2,584 pass(es).
[ View ]
#5 uc_addresses-views-access-filters-1900150-5.patch16.94 KBMegaChriz
PASSED: [[SimpleTest]]: [MySQL] 3,144 pass(es).
[ View ]
#4 uc_addresses-views-access-filters-1900150-4.patch16.11 KBMegaChriz
PASSED: [[SimpleTest]]: [MySQL] 2,931 pass(es).
[ View ]
#2 uc_addresses-views-access-filters-1900150-2.patch16.02 KBMegaChriz
FAILED: [[SimpleTest]]: [MySQL] Failed to run tests: PHP Fatal error encountered during run_tests.sh. See review log for details..
[ View ]
#1 uc_addresses-views-access-filters-1900150-1.patch5 KBMegaChriz
PASSED: [[SimpleTest]]: [MySQL] 2,682 pass(es).
[ View ]

Comments

Status:Active» Needs review
Issue tags:+Needs tests
StatusFileSize
new5 KB
PASSED: [[SimpleTest]]: [MySQL] 2,682 pass(es).
[ View ]

This is my first attempt for implementing the access filters. As mentioned in the issue summary, it does not work well with pager.

This could use some tests.

StatusFileSize
new16.02 KB
FAILED: [[SimpleTest]]: [MySQL] Failed to run tests: PHP Fatal error encountered during run_tests.sh. See review log for details..
[ View ]

Now with automated tests.

Status:Needs review» Needs work

The last submitted patch, uc_addresses-views-access-filters-1900150-2.patch, failed testing.

Status:Needs work» Needs review
StatusFileSize
new16.11 KB
PASSED: [[SimpleTest]]: [MySQL] 2,931 pass(es).
[ View ]

Now is ensured that the base test class is included.

StatusFileSize
new16.94 KB
PASSED: [[SimpleTest]]: [MySQL] 3,144 pass(es).
[ View ]

This adds some extra documentation. Other then that, I think it's ready. Let's see if it still passes tests.

Version:7.x-1.x-dev» 6.x-2.x-dev
Status:Needs review» Patch (to be ported)

Committed #5 with some small modifications in the code comments: there appeared to be a reference to the Views PHP module, which I had used as an example.

Needs backport to 6.x-2.x. I expects this could become quite a challenge, as some things work differently in Views 2.

Status:Patch (to be ported)» Needs review
Issue tags:-Needs tests
StatusFileSize
new18.46 KB
PASSED: [[SimpleTest]]: [MySQL] 2,584 pass(es).
[ View ]

It took me some hours to figure out, but here's a patch for the 6.x-2.x version. Again, I took Views PHP as an example, but then the 6.x-1.x version of that module in this case. I've also taken a bit other approach to find out how the address ID field is called in the results. For the 7.x-1.x version (see #5) this came more to guessing. The filter for the 6.x-2.x just adds two fields to query and uses that in the result rows to load the complete address and check access.

So, I probably need to make a few modifications to the 7.x-1.x implementation after I'm done with the 6.x-2.x implementation. Not only for consistency, but also because I think the 6.x-2.x implementation is more stable.

Version:6.x-2.x-dev» 7.x-1.x-dev
Status:Needs review» Patch (to be ported)

Committed #7.

Going back to the 7.x-1.x version, because the implementation probably needs to be improved for that version.

Status:Patch (to be ported)» Needs review
StatusFileSize
new4.63 KB
PASSED: [[SimpleTest]]: [MySQL] 3,387 pass(es).
[ View ]

Improvements for the 7.x-1.x version, following the 6.x-2.x approach.

Status:Needs review» Fixed

Status:Fixed» Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.