Hi,

Like your module. But I'd like to give some roles the permission to bypass the msnf setup.
Created a patch which allows a permission 'bypass msnf' to be set.

Cheers

CommentFileSizeAuthor
#8 img-1461948-8.png27.86 KBstBorchert
msnf.permission.patch857 bytesBartezz
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

stBorchert’s picture

Version: 6.x-1.2 » 7.x-1.0
Status: Needs review » Fixed

This is fixed in 7.x-1.0.
Other modules may alter the step information by using hook_msnf_info_steps_alter(&$steps, $entity_type, $bundle).
This way you can create a module which allows users with proper permissions to do not use steps at all.

Bartezz’s picture

Status: Fixed » Needs review

That's a solution as well but a bit drastic having to create another module to create permissions for a module?
Why not use my patch?

Cheers

stBorchert’s picture

Status: Needs review » Fixed

I'm sorry to say this but I do not find it quite useful to add this permission. Using hook_msnf_info_steps_alter() is more generic so you can hide or alter the steps in any way you like. Including allowing some users to not use the steps at all.

Status: Fixed » Closed (fixed)

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

thatjustin’s picture

I've been searching for help as to how to implement hook_msnf_info_steps_alter(), I tried searching and IRC, to no avail. I'm not clear what I should be passing to the function. Any help would be appreciated.

thatjustin’s picture

Category: feature » support
Status: Closed (fixed) » Active

Here's what I have so far for my own custom "lpub" module, and a custom role named "Manager" (I'm not making a dedicated permission just yet):

function lpub_msnf_info_steps_alter($steps_cached ){
  global $user;
  if (in_array('Manager', $user->roles)) {
# Unset steps here. How?
  $steps_cached	= FALSE;
  }                                                                                             
}
thatjustin’s picture

I'll post my solution to this issue, which is clearly not achieved via hook_msnf_info_steps_alter():

...
function msnf_field_attach_form($entity_type, $entity, &$form, &$form_state, $langcode) {
# My addition:
  global $user;
  if (in_array('Manager', $user->roles)) {
    return;
  }
...

It's not the correct Drupal way to check for perms, and it requires hacking the msnf module itself, but it was the method that worked for me.

stBorchert’s picture

FileSize
27.86 KB

Example to disable steps on node type "article":

<?php
function test_msnf_info_steps_alter(&$steps_cached, $entity_type, $bundle) {
  if ($entity_type == 'node' && $bundle == 'article') {
    $steps_cached[$entity_type][$bundle] = array();
  }
}
?>

Hiding steps for specific roles is as easy as the example above. Simply adjust the condition to your needs.

$steps_cached is a structured array of this form:

  • [entity type]
    • [bundle]
      • step definition
      • step definition
    • [bundle]
      • step definition
      • step definition

thatjustin’s picture

Status: Active » Closed (fixed)

Thanks.