Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2009-11-05 09:10:08

zoltandragon
Member
Registered: 2007-04-30
Posts: 47

User accesses ONLY their material (files, images, etc.)

I am wondering whether the following scenario can be done with TXP:

  • a user is given a role (obviously)
  • s/he uploads a file – but sees ONLY that file, not the uploads of others (not even the existing file function)
  • admin assigns a file/image for this user’s use only – so that no other users (not even those on the same level) can see/access it.

I am no coder, and I would really appreciate any ideas or directions as to where I should be digging for solutions :))

Thanx in advance!

Offline

#2 2009-11-05 10:22:46

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,454
Website GitHub

Re: User accesses ONLY their material (files, images, etc.)

Spooky, I was talking with someone last night about this very possibility.

afaict it’s not possible (cleanly/securely) without some further mods to the core. Essentially there needs to be some way (a callback perhaps) that would either allow:

  1. each row to be passed to a plugin so a decision can be made whether to include the row or not
  2. some way of a plugin modifying the query that TXP makes so the relevant rows can be omitted

Method 1 has a side-effect that the article counts and filters go haywire.

Method 2 has promise and was in fact what I did in this core hack although that had a few issues as noted further down the thread. Also, if site editors know the URL of an article or file, they could still get to the edit tab unless the plugin checked that too and refused access if the credentials didn’t match.

It’s not impossible, just needs some thought. I think the only non-hacky approach currently available is jQuery but that’s hardly satisfactory.

P.S. I moved the thread to How Do I… — the HowTos & Examples forum is for tips n stuff.

Last edited by Bloke (2009-11-05 10:28:20)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#3 2009-11-05 11:24:29

redbot
Plugin Author
Registered: 2006-02-14
Posts: 1,410

Re: User accesses ONLY their material (files, images, etc.)

Don’t know if this can be useful but there is a very useful plugin by Varias (asv_auth_articles) which does this for articles.
Maybe can be adapted to work with files

Offline

#4 2009-11-05 12:38:15

zoltandragon
Member
Registered: 2007-04-30
Posts: 47

Re: User accesses ONLY their material (files, images, etc.)

@Bloke: yeah, spooky – but it assures me that it’s not entirely stupid to think about it :) As for the hack – I am really a non-programmer, and whenever I venture to hack into the core, I realize that it should have done in some other way… so I stopped doing that – anyway, new versions are coming out, and there might be new problems with the hacks. But even if it needs serious thought to be pooled/pulled, I think it would be worth trying to do something about it, as it would be an awesome feature in TXP ;) (Saying that, I have no idea what it means to introduce something into the core…)

@redbot: thanks for the hint – I’ll check it out and see if it can be turned to function in a similar fashion with the files as well (although I suspect that it would need some serious alterations to the code – that’s where my limit is… :)

Offline

Board footer

Powered by FluxBB