1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

What does "Depends on Permission ID" do and when should it be used?

Discussion in 'XenForo Development Discussions' started by rugk, Feb 27, 2016.

  1. rugk

    rugk Active Member

    The setting "depends on permission ID" is a setting in the permission definitions. So lets take this example:

    So I already saw what it does not seem to do:
    1. The permission interface does not show in any way that the one permission depends on another one.
    2. It does not show a warning or something similar when example_createexample is set to "Never", but example_showexample is set to "Allow".
      Users can get confused when they want to allow "showing of an example text", but they forget to set allow for "creating example text".
    But as far as I tested it evaluates the permission correctly, so when example_createexample is set to "Never" and example_showexample to "Allow" example_showexample still evaluates to false, but this does not happen when example_createexample is set to "Not set".

    So is this correct and are the limitation (things it does not do) wanted?
    When should this setting be used?

    Attached Files:

  2. Mike

    Mike XenForo Developer Staff Member

    Essentially, when the final values are checked, if the "parent" permission is no/false, then the "child" permission will be forced to no/false. This is only done at the final calculation stage. If you have a not set and an allow across 2 groups, your final value is yes/true, so it won't apply.

    The purpose is mostly simplification/extra sanity checks in code to prevent a nonsensical situation. Only use it if there's a true dependency.
  3. rugk

    rugk Active Member

    Okay, thanks for the explanation. I think this answers all my questions.

Share This Page