We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 26310
    • 130 Posts
    Greetings,

    I’m trying to limit who can post to a gallery based on who created the parent document.

    I have a few issues going on here. First off, I’m using the example providing in the Wiki for getting one large image and thumbnails on a page.

    And I’m using a separate document as an image manager.

    I tried to use the &manager_webgroups as well as &manager_webusers parameters to limit who can upload but it seems to not work.

    Is it possible to restrict upload/edit capabilities based on the user who created the parent document given this setup?

    I should mention, I have a tiny snippet to pull the username of the author. I call that snippet within the MG call. My snippet seems to output the right name but MG doesn’t seem to function how I think it’s supposed to.

    Grab Username:
    global $modx;
    	$createdby = $modx->db->escape($createdid); 
    	$res = $modx->db->select("username", "modx_manager_users","id=".$createdby."");
        	 $cid = $modx->db->getValue($res);
    	echo $cid;

    MG call:
    [[MaxiGallery? 
    	&galleryPictureTpl=`mgGalleryPicture` 
    	&js=`mgJs` &debug=`0` 
    	&manager_webusers=`[!UName? &createdid=`[*createdby*]`!]` 
    	&manager_webgroups=`Bloggers`
    	&manage_target=`7`
    	!]


    I’m not sure where to add the logic though for authentication since I’m using a separate document for an image manager.
      I twitch because I care....and drink too much coffee.
      • 7923
      • 4,213 Posts
      You need to use the &manager_webusers parameter on the document you use to manage your gallery. Eg. you need to get the gal_id from the url query string in your custom snippet and get the "created by user id" from that gal_id document.


        "He can have a lollipop any time he wants to. That's what it means to be a programmer."
        • 26310
        • 130 Posts
        Thanks Doze. I adjusted my snipped and added it to the image manager page.

        In testing though I am still presented with an upload form even if I’m not the original document creator. Is this normal? I don’t see the existing images but have the privilage to upload additional ones.
          I twitch because I care....and drink too much coffee.
          • 7923
          • 4,213 Posts
          I guess the user belongs to Bloggers usergroup then.. Have you checked the manager_webgroups parameter from maxigallery wiki? It says:

          &manager_webgroups
          Comma delimited web groups that can post pictures to this gallery and can manage their own pictures.

          So all users belonging to Bloggers usergroup can add pictures to that gallery and manage their own.

          See the parameters and what effect they have from maxigallery wiki page.


            "He can have a lollipop any time he wants to. That's what it means to be a programmer."
            • 26310
            • 130 Posts
            At the end of the day I guess it’s no biggie if everyone in the bloggers group can add pics and only manage their own. Thanks for the feedback Doze.
              I twitch because I care....and drink too much coffee.