Welcome, Guest
Username: Password: Remember me

TOPIC: Limit items view only to the author

Limit items view only to the author 27 Oct 2012 00:53 #4755

  • jcbenton
  • jcbenton's Avatar
  • Offline
  • Premium Member
  • Posts: 125
  • Thank you received: 9
  • Karma: 3
Yes... I searched. For like an hour :)

I just start using Cook. (Very nice BTW). So I am building a couple of tables with admin and front end views. So, how do I restrict content to the user that owns it? For example, I make a record that has the user's ID included as part of the record, but other users can still see it.

I can easily overcome this by changing the DB query to pull only the user's records in the PHP code. I was just wondering if that is an option in Cook.

Jerry
--
Jerry Benton
The administrator has disabled public write access.

Limit items view only to the author 27 Oct 2012 06:52 #4757

  • JoomGuy
  • JoomGuy's Avatar
  • Offline
  • Moderator
  • Joomla Enthusiast, Lover of Cooking
  • Posts: 1115
  • Thank you received: 195
  • Karma: 64
Hi there,

You can achieve this by using the author/created_by wizard, an access wizard, adding a publishing wizard where it's value is preset to 0. You could even leave this off the form so it cannot be 'published' by the user(s).

This will mean that in the front-end, none of the items created in that table will be 'public'. You will then need to set the permission view own too, to ensure that users in whatever group you're allowing access can view their own records.

Hope this helps!

Gez
Need help with your Cook/Joomla Project? . PM me to find out what I can help with. NO time wasters please!!!
The administrator has disabled public write access.
The following user(s) said Thank You: admin

Limit items view only to the author 27 Oct 2012 07:18 #4758

  • jcbenton
  • jcbenton's Avatar
  • Offline
  • Premium Member
  • Posts: 125
  • Thank you received: 9
  • Karma: 3
Thank you. Will give it a try.
--
Jerry Benton
The administrator has disabled public write access.

Limit items view only to the author 27 Oct 2012 08:01 #4763

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 984
  • Karma: 140
@jcbenton
Welcome to the community.
There is not silly question until the documentation is not availlable. But I just ask you to give a correct title, describing your problem. I will edit it or you.


@audibleid,

When you say to remove the publish state for the form, obviously it is correct, but at the end, if the user do not have the 'code.edit.state' ACL right, the publish input will not be shown at all.

So only the authorizated will be allowed to set it up.
The admin can publish the item when this item have to be seen by everybody. In some cases it is usefull, sometimes it is not necessary at all. Depends the use of your application.

I just wanted to precise this.
Coding is now a piece of cake
The administrator has disabled public write access.
The following user(s) said Thank You: JoomGuy

Re: Limit items view only to the author 27 Oct 2012 08:07 #4764

  • JoomGuy
  • JoomGuy's Avatar
  • Offline
  • Moderator
  • Joomla Enthusiast, Lover of Cooking
  • Posts: 1115
  • Thank you received: 195
  • Karma: 64
Thanks for clarifying!

Gez
Need help with your Cook/Joomla Project? . PM me to find out what I can help with. NO time wasters please!!!
Last Edit: 27 Oct 2012 08:11 by admin.
The administrator has disabled public write access.

Re: Limit items view only to the author 27 Oct 2012 12:21 #4780

  • jcbenton
  • jcbenton's Avatar
  • Offline
  • Premium Member
  • Posts: 125
  • Thank you received: 9
  • Karma: 3
Hello Again. I appreciate the replies, but I am still having no luck with this. I am also running into another problem:

- When I create a single table and the associated form, I add the Joomla User option and for the control type I select "list", which in the Cook builder I see the Joomla type select list. However, when I run it in the sandbox and try to add a new record the list box is instead a text box. Am I doing something wrong here?

The entire component will only have 3 tables. It is a software license management system, so 1 table is for license requests. Table 2 is for licenses. Table 3 is just for logging. The admin can see all 3 tables. The user can see the Request table and the License table. However, they should only see their own license.

While I am rather adept at PHP, my Joomla knowledge is not as high, so I could be misunderstanding something in the logic of the MVC here.

Any suggestions?
--
Jerry Benton
The administrator has disabled public write access.

Re: Limit items view only to the author 22 Nov 2012 10:07 #5608

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 984
  • Karma: 140
Do you still experience problems with that ?
You shouldn't have probleme here. It is strange...

Which version ? 2.0 ?
Coding is now a piece of cake
The administrator has disabled public write access.
Time to create page: 0.128 seconds

Get Started