Fork me on GitHub

Problem setting up permissions on new module.  Bottom

  • NOTE: I already posted this in the User-to-User module forum, but it's proabably more suited to this forum. Sorry for the double post.

    Hi,

    I'm working on a custom module and am having problems with permissions.

    The particular function starts out like:

    Code

    function testmodule_admin_addstuff()
    {
     
      echo "Here1<br>";

       if (!pnSecAuthAction(0, 'testmodule', "::", ACCESS_ADD)) {
        return pnVarPrepHTMLDisplay(_MODULENOAUTH);
      }
      echo "Here2<br>";


    I added the echo statement for debugging.

    I created a Group called Friends and added a user to the Friends group.

    I am using these permissions:

    Quote


    1 Admins .* .* Admin
    2 All groups Menublock:: Main Menu:: None
    3 Friends testmodule:: .* Add
    4 Users .* .* Comment
    5 Unregistered Menublock:: User Menu:: None
    6 Unregistered Menublock:: Main Menu:: None
    7 Unregistered .* .* Read


    However, when I log into the account of a user that is a part of the "Friends" group and try to access the function, I get this error:

    Quote


    Sorry! You do not have authorization to access this module


    How can I fix my permissions to make this work?

    Thanks,
    Grant
  • Check your permissions component in your pnSecAuthAction call - your missing the :: on testmodule.

    -Mark

    --
    Visit My homepage and Zikula themes.
  • Thanks Mark!

    I had just fixed it by changing:

    Quote


    3 Friends testmodule:: .* Add


    to

    Quote


    3 Friends testmodule .* Add


    I guess I did it backwards. Your saying that I should really be using:

    Code

    if (!pnSecAuthAction(0, 'testmodule::', "::", ACCESS_ADD)) {


    instead of:

    Code

    if (!pnSecAuthAction(0, 'testmodule', "::", ACCESS_ADD)) {


    Is that right?

    Thanks,
    Grant

This list is based on users active over the last 60 minutes.