Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC:

User permissions for different tables 25 Sep 2012 18:10 #3988

Hello,

I'm building a very simple component. It has one table ("Company") that lists company names, and one table ("User_Company") that associates those company names to users. On the front end the user should be able to add a record to the Company table, and also add records to the "User_Company" table so they can associate their user id with one or more companies.

If I set user permissions to "Create/Edit/Delete" the user can see all of the records in the User_Company table, not just their own. If I only allow "View/Edit/Delete Own" the user can only see their records in the User_Company table -- perfect. But if they access the form to create a new record, they can only see the names of companies in the Company table that they created.

Is there a way around this problem? Basically, I want one layout where the user can only see their records, and a form where the drop-down field allows them to select from all records, not just their own.

Please Log in or Create an account to join the conversation.

Last edit: by admin.

Re: User permissions for different tables 25 Sep 2012 18:15 #3990

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 986
Combine with publish wizard.

Try to instance the publish wizard, and let the publish state to false for each item.
Coding is now a piece of cake

Please Log in or Create an account to join the conversation.

Re: User permissions for different tables 25 Sep 2012 18:24 #3991

In the table "Company" I have used the publish wizard. I changed its default value to "0", but the front end user can still only see records from that table that they have created.

Please Log in or Create an account to join the conversation.

Re: User permissions for different tables 25 Sep 2012 18:37 #3992

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 986
I read better, and I understand better your problem.

As you can see, the model is protecting the access everywhere, you cannot do any mistake.

To skip this, change the query related to the list filling, in the list model of Companies, function prepareQuery().

The query is called from the view where your combo is.
The best to do that is to play with states vars.
$model->setState('filter.published', null);

Not tested.
If it do not work, try to play around in prepareQuery() + new state vars.
Coding is now a piece of cake

Please Log in or Create an account to join the conversation.

Last edit: by admin.
  • Page:
  • 1
Time to create page: 0.062 seconds

Amazing Tool !
And only tool I know that allows complete Scaffolding in terms of component creation. It really saves loads of time (actually much more than that). Simple architecture enables quick and painless changes at any time. Code is clean and consintent. It's just... what's the word... neat! :) Great work! You should definetely try this one!

pi_wo (JED)
         

Get Started