Description
The Contentaccess roles module gives node authors the ability to let users in selected roles view nodes. This is great if you want to restrict node view access by role on a per node basis, but allow anonymous access to the teaser.

Project page:
https://drupal.org/sandbox/abdirisak/2074287

Git repository:
git clone http://git.drupal.org/sandbox/abdirisak/2074287.git contentaccess_roles

Comments

PA robot’s picture

Status: Needs review » Needs work

There are some errors reported by automated review tools, did you already check them? See http://pareview.sh/pareview/httpgitdrupalorgsandboxabdirisak2074287git

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.

abdirisak’s picture

asherry’s picture

You'll need to add an .install file with hook_uninstall() to remove the variable_set's. Something like this -

<?php
/**
  * Implements hook_uninstall().
  */
function contentaccess_roles_uninstall() {
  foreach (node_type_get_types() as $type) {
    variable_del('contentaccess_roles_config_' . $type->type);
    variable_del('contentaccess_roles_config_' . $type->orig_type);
  }
}
?>

The ->orig_type is probably unnecessary, but since you can change a content type's machine name it's something to think about. Theoretically if they changed the content type's machine name, and had already saved settings for your module, there will be multiple variables.

Or you can add a hook for when a content type machine name is updated.

abdirisak’s picture

Status: Needs review » Needs work

Hi Asherry,

Thanks for your review, .install file added.

abdirisak’s picture

Status: Needs work » Needs review
sanduciprian’s picture

Status: Needs work » Needs review

You got some code issues with the new .install file added

http://pareview.sh/pareview/httpgitdrupalorgsandboxabdirisak2074287git

jay.chen’s picture

Status: Needs review » Needs work

If you define some custom hooks, you should create a MODULE_NAME.api.php file.

For your module, you should create two hook examples for the hook_contentaccess_roles_fields_info and hook_contentaccess_roles_fields_info_alter.

See the node.api.php file at https://api.drupal.org/api/drupal/modules!node!node.api.php/7 .

abdirisak’s picture

Status: Needs work » Needs review

Hi Jay.Chen,

Thanks for your review, .api.php file added.

http://pareview.sh/pareview/httpgitdrupalorgsandboxabdirisak2074287git

stockunlocks’s picture

StatusFileSize
new41.59 KB

After manually looking over the code, I attempted to review based on an install. However, I received an error after I enabled the module, saved and then ran the Drupal database update script.

Here's what I got:

FieldException: Attempt to create a field of unknown type <em class="placeholder">contentaccessroles</em>. in field_create_field() (line 110 of /Library/WebServer/Documents/stockunlocks/modules/field/field.crud.inc).

I've included a screenshot below.

Interestingly, the FIELD TYPE "Contentaccess roles" (MACHINE NAME: "field_accessroles") is available when I access /admin/structure/types/manage/article/fields. Following the instructions for setting up access didn't produce any errors. I used an existing role. Unfortunately, it doesn't seem to have an effect when I access content as an anonymous user (no roles enabled).

I used the commit dated: Sat, 7 Sep 2013 11:33:59 +0000 (13:33 +0200)

If this can be corrected, I'll gladly come back and try it again.

abdirisak’s picture

StatusFileSize
new14.58 KB
new5.96 KB

Hi darrellhenry,

Thanks a lot for your time, I tested this module (drupal-7.23) and when I enabled the module, saved and then ran the Drupal database update script, I didn't got any error, I don't know which drupal version do you using. But I didn't got any error after I tested (drupal-7.23).

When you creating new content, if you don't select any role(s), so this content you created will be visible to all users. If you need to show your content to users who have specific role(s), you must select one or more role(s), otherwise the content will be visible to all users.

For example, if you create new content and select "authenticated user", and then try to access content as an anonymous user, so you will get a message denying access.

This module is working correctly, can somebody review it, please?

stockunlocks’s picture

... I'm running Drupal 7.22. When I get a chance, I'll set up for 7.23 and get back to you. Thanks.

p.s. If you want to get on the "priority review list" to move your project along, check this out: https://drupal.org/node/1975228

jay.chen’s picture

Status: Needs review » Needs work

1. Please update the git repo on the issue summary because the link doesn't work
git clone http://drupalcode.org/sandbox/abdirisak/2074287.git contentaccess_roles. It should be
git clone http://git.drupal.org/sandbox/abdirisak/2074287.git contentaccess_roles

2. When I created a new content type via admin UI, the content access roles settings is set to disabled. But when I enabled the blog or forum modules, the settings is set to enabled.
Suppose the settings should be always set to disabled by default, right?

3. I am running Drupal 7.23, and I did see the #10 error issue sometime but I didn't find when it happened.

stockunlocks’s picture

Status: Needs review » Needs work

Hi, just to let you know that I've updated to Drupal 7.23 and the same error, as in #10 above, appears immediately after I enable the module and click "Save configuration".

I'm using the latest snapshot: Sat, 7 Sep 2013 11:33:59 +0000 (13:33 +0200) (same as above).

It's the exact error as in the screen shot attached above, no need to add another one here.

abdirisak’s picture

Status: Needs work » Needs review

Hi,

Thanks for the review(s).

1. Updated git repository link.

2. Fixed, the settings will be always disabled by default.

3. I have enabled the module and didn't see any error, So I need to know when exactly this error happen to fix the #10 error issue.

@darrellhenry,
I think you get this error, because the module installation failed at some point and is not fully installed. Could you please try to disable, uninstall then reinstall the module and clear all caches?

Please install the latest commited by first disabling and uninstalling the module
git clone http://git.drupal.org/sandbox/abdirisak/2074287.git contentaccess_roles

kscheirer’s picture

Status: Needs review » Reviewed & tested by the community

The description doesn't make sense, how about "Make nodes visible only to users with specific roles" instead? Otherwise this looks like a useful module.

----
Top Shelf Modules - Crafted, Curated, Contributed.

abdirisak’s picture

Thanks kscheirer for your review, I have just committed your suggestion and the description has been changed.

sanchiz’s picture

Hi, i did visual review and saw not correct PHPDOC

115

/**
 * Return TRUE if CONTENTACCESS_ROLES_FIELD exist.
 *
 * This is a wrapper function around
 * contentaccess_roles_get_field_infoinstance().
 *
 * @param string $entity_type
 *   The entity_type
 * @param string $bundle_name
 *   The content type to be checked.
 */

must be correct or removed

/**
 * Return TRUE if CONTENTACCESS_ROLES_FIELD exist.
 *
 * This is a wrapper function around
 * contentaccess_roles_get_field_infoinstance().
 *
 * @param string $entity_type
 *   The entity_type
 * 
 * @param string $bundle_name
 *   The content type to be checked.
 * 
 * @return bool
 *   Return some value
 */

On the 420 line too.

This is really good idea and I can not find module with similar functionality.
Another issue about access.
If we provide a menu link for node with access only to admin, we see this link always. Is there some sort of solution for this issue?
Similar situation with views, node appear always. Checking user permission only on node page view. Is there a way to fix it?

Overall, it looks very cool!

abdirisak’s picture

Hi sanchiz,

Thanks for your review.

1. Corrected phpdoc comments.

2. This module controls the user's permission only on the node page view, but not on views or teaser.
The idea is to show node teasers/views on the front page while restricting full page view access to authorized users, or to encourage anonymous users to log in or to encourage authorized users to subscribe.

abdirisak’s picture

Hi,
I waited almost 20 days and no one else raises any issues, so what's the next step I've to do?

kscheirer’s picture

No further action is required, but the best thing you can do is get a Review Bonus by reviewing other applications. That will get you to the top of the list of projects to get reviewed (and hopefully approved). Only manual reviews count, just using http://pareview.sh is not enough.

Or if you wait a month and no one else raises any issues, I will send this application to "fixed" myself, which grants you "git vetted user" status and the ability to promote your sandboxes to full projects (including this one).

kscheirer’s picture

Issue summary: View changes

Updated the git repository url

kscheirer’s picture

Issue summary: View changes
Status: Reviewed & tested by the community » Fixed

It's been a month without any problems reported, so I'm promoting this myself as per https://drupal.org/node/1125818.

Thanks for your contribution, abdirisak!

I updated your account to let you promote this to a full project and also create new projects as either a sandbox or a "full" project.

Here are some recommended readings to help with excellent maintainership:

You can find lots more contributors chatting on IRC in #drupal-contribute. So, come hang out and get involved!

Thanks, also, for your patience with the review process. Anyone is welcome to participate in the review process. Please consider reviewing other projects that are pending review. I encourage you to learn more about that process and join the group of reviewers.

Thanks to the dedicated reviewer(s) as well.

----
Top Shelf Modules - Crafted, Curated, Contributed.

Status: Fixed » Closed (fixed)

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