1. REGISTRATION REQUIREMENTS:

    Register with your xenforo.com Username then start a conversation at xenforo.com w/Bob and provide the following:
    1. Your XenForo License Validation Token
    2. The Domain Name associated with the License
    NOTE: Your account will be validated once ALL requirements are verified/met. Thank you for your patience.

Fixed Drafts are bypassing the Max Item Count limit

Discussion in 'Showcase Resolved Bug Reports' started by Empire, Feb 8, 2016.

  1. Empire

    Empire New Member AMS Premium CAS Premium RMS Premium SC Premium UBS Premium

    Currently a member can get around the item limit by making a bunch of drafts and publishing them at leisure. For example, a member had a limit of 5 showcase items, but she made 14 drafts at once and then set them all to display.

    It would be nice if there were an option to either limit the number of drafts in addition to live items, or to make drafts count towards the limit for live items. Or make it impossible to set a draft to public if they are already at their limit.
     
  2. Bob

    Bob Developer Staff Member

    This is more of a BUG than a suggestion, so I've moved it into the bugs forum so I can do some investigating. Probably need to add a bit more heavy evaluation to the Item Limit checking in the preSave of the Item Datawriter.

    EDIT: I've modified the permissions checking, controller actions and datawriter to better handle this. This includes showcase items that are in the moderation queue as well. The permissions check will now not only check the visible count, but also see if there are any drafts or items awaiting approval and if there is, those count towards the total and will prevent a draft from even being created, let alone being published.
     
    Last edited: Feb 8, 2016
  3. Empire

    Empire New Member AMS Premium CAS Premium RMS Premium SC Premium UBS Premium

    Oh wow, thanks for that! I didn't realize it was a bug.
     
  4. Bob

    Bob Developer Staff Member

    I've modified the permissions checking for the creating of items as well as added in some throwing of errors when attempting to cheat the system. I also added in code to handle Legacy issues (in case someone has a bunch of draft items created, it now checks for that and won't let them publish them if that means exceeding the max items count).

    This is an example of the error message that will be thrown when attempting to bypass the Max Items limit.

    Selection_111.png
     
    Empire likes this.
  5. Bob

    Bob Developer Staff Member

    IMPORTANT NOTE TO DEVELOPERS

    The method: NFLJ_Showcase_Model_Item::canCreateItem has been removed. You MUST use the similar method in the Category Model from this point forward.

    The method: NFLJ_Showcase_Model_Category::canCreateItem has CHANGED. There is a NEW Param ($extra) that has been added (as shown below). This new param is the 2nd param of the method, so if you are using this method, be sure to modify your calls to it.
    PHP:
        /**
         * Determines if a user can create a showcase item. Does not check category viewing perms.
         *
         * @param array|null $category (May be null if no category is specified)
         * @param array|null $extra (May be null if no extra data is specified)
         * @param string $errorPhraseKey
         * @param array $viewingUser
         * @param array|null $categoryPermissions
         *
         * @return boolean
         */
        
    public function canCreateItem(array $category null, array $extra null, &$errorPhraseKey '', array $viewingUser null, array $categoryPermissions null)
     
  6. Empire

    Empire New Member AMS Premium CAS Premium RMS Premium SC Premium UBS Premium

    I have a question related to this. What if someone is in a usergroup that allows 20 showcase items, and then they are demoted to a usergroup that only allows 10. What would happen to the ten above the limit? Would they just not be able to add more, or would they still be able to edit them but not add more, or would some be deleted or invisible?

    Also, is the fix in 2.5.4? Or is it for a future version? I upgraded to 2.5.4 but I didn't notice whether it came out before or after this.

    Thanks for your help, as always!
     
  7. Bob

    Bob Developer Staff Member

    The 'Max items per user' permission only comes into play during the CREATE Item process (also determines whether the "Create Item" button displays for them) and the Publish Draft Process (which is now has its own special checking). If someone has 20 items and you move them to another group that can only create 10, then they simply will not be able to CREATE any new items nor will the be able to publish any draft items that they may have in the draft queue. They will still be able to edit all 20 of their items as well as edit any drafts that they might have.

    I TAG every implemented suggestion thread or fixed bug thread with the version that its applicable to. In this case, its been included with the upcoming release (showcase 2.6.0 beta 1).

    Selection_113.png
     
    Empire likes this.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.