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

Give Explicit Attachment Viewing Permissions?

Discussion in 'XenForo Development Discussions' started by Jaxel, Dec 26, 2010.

  1. Jaxel

    Jaxel Well-Known Member

    Okay... I have my XenPorta mod:
    http://www.8wayrun.com/portal/

    I also have attachments, that are viewable by registered users. Attachments are NOT viewable by unregistered/unverified users. I would like to keep attachments not viewable by unregistered/unverified.

    However, on the portal, and only the portal, I want to explicitly give attachment viewing permissions to everyone. So that if I use the ATTACH bbcode to embed an attached image to an item, that attachment is viewable by everyone who views the portal page, even if they aren't logged in,
     
  2. Jaxel

    Jaxel Well-Known Member

    So is this at all possible?
     
  3. Shadab

    Shadab Well-Known Member

    I haven't looked closely at the code behind it; but I don't think it's a trivial task. The attachments are viewed and embedded using this url format: /attachments/title.id/. When you access an attachment, the controller doesn't know from where it was embedded or accessed. So it's a bit hard to selectively grant permissions that way.

    When accessing an attachment, you can fetch the posts displayed on your portal and the associated attachments. Then do a check if the attachment being accessed is in your list. But then, I don't think it's a good idea to have such a huge performance overhead.
     

Share This Page