Certain tables visible to certain users?
12 posts
• Page 1 of 1
Certain tables visible to certain users?I can set the permissions like view, edit, delete etc, but how do I set permissions to make a specific table available to a user depending on the user logged in? When the user logs in how do I set that specific table as the default table? What about the table tabs, can I disable the table tabs the user has no access to?
Re: Certain tables visible to certain users?If you're using 1.3+ you can use the getNavItem() and isNavItemSelected() application delegate class methods.
http://xataface.com/wiki/getNavItem If you're on a previous version, you may want to look at this discussion for some strategies: viewtopic.php?t=5201#25312 -Steve
Re: Certain tables visible to certain users?I read through the link but it describes the case, admin vs regular user rights. In my case, I have 3 regular users but I want them to only see tables they are allowed to see. User A can see Table A but not Table B. User B can see Table B but not Table A. In the link it uses the isadmin() function, what would I need to use here to distinguish User A from B?
Re: Certain tables visible to certain users?This is a permissions issue. You need to define a permissions strategy for your system. The isAdmin() is a custom function made for the particular application that was being developed. Different applications will have different criteria for who is an admin and who is not an admin. If you define your permissions then you can use those permissions in either of these strategies in order to decide who sees which tabs.
For information on permissions read the section in the getting started tutorial, and there are many documents in the wiki regarding setting up permissions. -Steve
Re: Certain tables visible to certain users?I looked at some alternatives and come across the unset method.
I tried this out but it didn't quite work out for me.
What would be the drawbacks of using unset() rather than getnavitem()?
Re: Certain tables visible to certain users?No drawback. Just make sure you're also disallowing access to the table using permissions. unsetting an element of the conf->_tables array will only remove the navigation tab to the table. If they have permission to access the table then they will still be able to enter the URL to the table directly.
-Steve
Re: Certain tables visible to certain users?Still having problems. Here's my code in the class delegate file
Taking off the isValid() and isLoggedIn() methods from the init() function works, but returns the same results for everyone. My problem is in those 2 functions.
Re: Certain tables visible to certain users?If isValid and isLoggedIn are defined as methods of the delegate class then they'll need to be called like:
Also are you showing the whole delegate class file here or only a snippet? I don't see the class definition here, just some functions. -Steve
Re: Certain tables visible to certain users?Here's the whole class:
I made the changes to isLoggedIn() and isValid() as you mentioned but I get the same results.
Re: Certain tables visible to certain users?What are those results? Are you getting an error message of some kind?
Re: Certain tables visible to certain users?I found the problem. It was a simple syntax error. Thank you!
Say I wanted to enable the unset tables, whats the vice versa method of unset()?
Re: Certain tables visible to certain users?Opposite of unset() is to just set the value. i.e.:
12 posts
• Page 1 of 1
Who is onlineUsers browsing this forum: No registered users and 1 guest |