Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2023-03-14 23:08:50
- lindabb
- Member
- Registered: 2023-02-17
- Posts: 132
restrict author
Hello,
Is there a way to restrict author to view and change by owned articles only.
Now, any author can change, delete any article , what I need to do allow only the owner to change, or delete their articles.
also restrict or hide or disable sort and display div
Thank you
Offline
Re: restrict author
lindabb wrote #335072:
Hello,
Is there a way to restrict author to view and change by owned articles only.
Now, any author can change, delete any article , what I need to do allow only the owner to change, or delete their articles.
also restrict or hide or disable sort and display divThank you
Bot_Privs might meet your requirements
…. texted postive
Offline
Re: restrict author
Have you checked this article on “User roles and privileges” in the documentation?
You certainly can restrict authors to a limited set of actions.
Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern
phiw13 on Codeberg
Offline
#4 2023-03-15 14:01:24
- lindabb
- Member
- Registered: 2023-02-17
- Posts: 132
Re: restrict author
Thank you all
Offline
Re: restrict author
smd_user_manager might help as you can create new roles and customise the privileges accordingly.
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Hire Txp Builders – finely-crafted code, design and Txp
Offline
#6 2023-03-15 16:54:02
- lindabb
- Member
- Registered: 2023-02-17
- Posts: 132
Re: restrict author
Thank you Bloke,
smd_user_manager worked, (Bot_Privs got mysql error). I wish the plugin had , show only owned articles, files, images so on,
no need to show other articles if no access, in this case , other authors can have private articles or files .
just an idea.
Thank you
Offline
Re: restrict author
lindabb wrote #335087:
(Bot_Privs got mysql error).
Note works for me in this envirnoment
PHP version: 7.4.30 MySQL: 5.5.5-10.3.38-MariaDB (MariaDB Server)
edit to add :
User can edit articles User can edit only published articles User can edit only his articles User can edit only his published articles User can publish new articles User can delete only his articles
Last edited by bici (2023-03-15 17:19:25)
…. texted postive
Offline
#8 2023-03-15 17:35:40
- lindabb
- Member
- Registered: 2023-02-17
- Posts: 132
Re: restrict author
Thank you bici ,
I’m using dev 4.8.9 version with php 8.1 , that plugin didn’t work, but Bloke’s suggestion worked for me,
I looked at Bot_Privs , looks minor change or comment out mysql version will work, but I didn’t want to change it.
Thanks again
Offline
Re: restrict author
lindabb wrote #335087:
I wish the plugin had , show only owned articles, files, images so on,
That’s not a priv we have available, but it’s trivial to write a plugin to do it :)
(see the 2nd example plugin in that post)
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Hire Txp Builders – finely-crafted code, design and Txp
Offline
#10 2023-03-15 20:43:15
- lindabb
- Member
- Registered: 2023-02-17
- Posts: 132
Re: restrict author
Thanks Stef ,
I have installed the plugin, and enabled it, do I need anything else to make it work ?
Now when I login as restricted user, still I see others’ articles
Thank you for your help
Offline
Re: restrict author
Hmmm it should just work out of the box. All it does is add the relevant clause to the query. Let me test it and get back to you.
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Hire Txp Builders – finely-crafted code, design and Txp
Offline
Re: restrict author
Ah wait, you need to ensure it’s of Plugin Type 3 (admin). Otherwise it won’t run.
Try this compiled plugin instead:
# mrd_for_your_eyes_only v0.1.0
# Users can only view their own content
# Stef Dawson / Dale Chapman
# https://stefdawson.com/
# ......................................................................
# This is a plugin for Textpattern - http://textpattern.com/
# To install: textpattern > admin > plugins
# Paste the following text into the 'Install plugin' box:
# ......................................................................
H4sIAAAAAAAAE+VUwWrjMBC95ysGE3ACJYmdJm1ccijby8LShS09m7E1jkVlyUhysqb033dk
u720/YLVQdaMZt48vZGMWZJmry67ziKNDUV3LkvTLGqsyCtj8950NqeeXG606sPuTRadyTpp
dLB2WbRZJatNWO+zCDtfGzuAsPXkqYIHvDijYc0LRfCjxrbBITXZvMfnnZVDzjaLau9bl63X
jnPFkLoqTbMeEpIsEuRKK1s/ld8ym2fHdKBEDYEinCVdwNckLZiLhtJoT9pPXI0VNNBjqF34
8rF939Lk2k5hlcKTm3ybKawm1Q4kr4ORrOBriWaz37okII2FInEF3cCuwX5k54g+k1vBo/EE
DASuNp0SnO46+x7ZWnmWik4Eis6kAJUlFD1Yct7K0jsgIb3UJzDVZ3CopHX+Cgzv2It0AVU6
sJ2QDW+j7TlCebLAXkInmWXRt+gcCRYTAyI8//m1mnQojaBReu6WpZPkTtm8RKUKLF8W8dey
xFcQo2ikzrl9nCAxXt7NZlWny9DLb8RczOnM1OfOtzyHzCW8zoDHSZkCFcz93zYPEt8N3nlY
whGEeVLo6sXHdqgVAmQFi4AGx+MRYsXc8zDF77BhWPKd1RDB/eMD3A8X9OcDg8YDehyNpd6A
FGsZAPlQaC32i5HnuGZw/TKC89FZYfowZIOnyVouv608Po3PdWdvQf3b8ULmFi///aXke9iI
4TVv+c+122GRFof9TVrSIaV0t09wuy/Tsri9PRwSjnv7B+cEeIb0BAAA
As noted in that thread I linked to, it might be a good idea if Publishers were exempt from the restriction so they can see all content. That would require a couple more lines of code.
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Hire Txp Builders – finely-crafted code, design and Txp
Offline
#13 2023-03-15 22:41:12
- lindabb
- Member
- Registered: 2023-02-17
- Posts: 132
Re: restrict author
Thank you so much, you guys the best.
I appreciate your help, it worked exactly as I wanted.
however , there is one thing kind of security issue, I understand even user doesn’t have permission to update, but the idea to hide others’ articles from viewed by others.
if I have
http://localhost/textpattern/textpattern/index.php?event=article&step=edit&ID=10&_txp_token=abdccd9fb542dc52a187720f9fc1c6b3
now change the id to 1 or 2, or 3 (or any existing id) author still can view the article by id.
http://localhost/textpattern/textpattern/index.php?event=article&step=edit&ID=2&_txp_token=abdccd9fb542dc52a187720f9fc1c6b3
Maybe need some restriction on view too
Thank you for your kind support
Offline
Re: restrict author
Yes, absolutely. The plugin’s only a cheap hack to show what’s possible (the help text mentions this).
It would need extending slightly to prohibit viewing from the Write panel too.
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Hire Txp Builders – finely-crafted code, design and Txp
Offline
Re: restrict author
This version should do it. Not tested particularly extensively so YMMV:
# mrd_for_your_eyes_only v0.1.0
# Users can only view their own content
# Stef Dawson / Dale Chapman
# https://stefdawson.com/
# ......................................................................
# This is a plugin for Textpattern - http://textpattern.com/
# To install: textpattern > admin > plugins
# Paste the following text into the 'Install plugin' box:
# ......................................................................
H4sIAAAAAAAAE+VW227bOBB991dMhaCygcCx7NRJZXiBoH4J0O0C2+ZZYMSRTZQiVZKyKxT5
9x3qFqm5LNp9XAE2bzNnDs8MKbE4WsY/bHwZB4rlGGxsvFzGQW54kmmTVLo0CVZoE61k5Vev
4uCIxgqt/OhdHCzm0Xzh++s4YKU7aFOD0Oizwwx27GS1ggvqSIQPB1bkrHaNFp19UhpR+6zi
4OBcYeOLC0u+vHadpzq/qB2iOOBoUyMK14ZfEZs7S3QgZQo8RTgKPIE7oDCgTwpSrRwq13LV
hmNNj6De+Za27aoC26lVa5ZJtrft3KI1O6AsapKXfhDN4XmJJpO/VIqAit1L5OdQ1uxyVjXs
LOJTcnP4pB0CAYE96FJycrel6SwLI45C4h5B4hElMGmQ8QoMWmdE6iwgF06oPejsKThkwlh3
DppWzElYjyosmJKLnJaZqchCOjRAs8isIJb3VcGsRU5iMo8Id39/nLc6pJo3cl1eUQIN7gWl
yiQpk/KepV+n4fO6hOcQMp4LlVD+yEGwcLaZ/Js7bZGaFB8hjBOpRN+lX/Q7ECJne+w7idfu
d6FIOOza/wQkhfratUOgSVaq1Bf7C9U2PcMj5fbMuoL+vbKzyY8J0LOX+p5JOHPfi8TX4Kae
PfNd2ALXnyWzh2m/7GN5A5HB1KPBdrv1dKxL/F84gwbWPwZdaRQEcPNpBzf1Cb7dEWhYo4dB
E+oBUFKxeUBKOjOGVdOGZ9Nv9lqDdwp2gyYxTdzZi5Gbu+Np3MnDS7KNZB9I97JmjWid300X
UZVSbsZrfzLSrN1azzf0SE29wfaPccWNjepKgtpoUExjm7pIGptBnfQ2oxTS3poUdgdmKGNP
uk7bvrDT8HYXdv49xqPV0Pl5RSzLkDaBkk/DriR8Kh1+dwVzdBYUDYPb3TaY+6vFuEQoN4ox
2/QxHoYV9CpvwcOBX2/whe70Lh2JRWbSQ1t8w4S9smN4+3aM9msSNLUZno8xSADBf0WAQUJ/
Ckf0nsy9oXw/HujxuflWCoOJf5PY6aw/KP4ev25ebYlhp//9642+P3Jefxes6BvoenGVrpcL
tn6/vsyi5Spi0TJj2TpdXr9fZxHZPfwD/MqbXz4JAAA=
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Hire Txp Builders – finely-crafted code, design and Txp
Offline