hi - How does one make a widget appear only if a certain user is logged in? How would one for instance make the 'views' box appear only if the admin user is logged in? (Is there a place I could have found the answer? I read the docs I found and browsed the archives, but didn't find anything. I'm working my way to the relevant place in the code, but a nudge would be useful.) thanks, ts _______________________________________________ SmallWiki, Magritte, Pier and Related Tools ... https://www.iam.unibe.ch/mailman/listinfo/smallwiki |
Hi,
First make sure you have an add-on to Pier that allows you to manage users. I use Pier Unix Security (you can load it from Squeak Map and it will load Pier as well). When it comes to rights, pages and components are similar. Here is one solution I used for a similar problem: - Load Pier Unix Security from Squeak Map. - Add System page as child of the root. I named it =System to make it appear first in the list of pages. - Add System Users component as child of the =System page. - Add System Groups component as child of the =System page. - Add a user that is in the admin group (or just use the default admin user). - Go to the root page, select Change Owner command, check the Recursively check box to affect all pages, and change the owner to be the admin user. - Go to the pages you do not want the others to see, and using the Change Other command remove the View ability. You can also play with groups, by making the page belong to a certain group and then place the wanted users in that group. Cheers, Doru On Oct 14, 2007, at 1:15 AM, [hidden email] wrote: > > hi - > > How does one make a widget appear only if a certain user is logged in? > How would one for instance make the 'views' box appear only if the > admin user is logged in? > > (Is there a place I could have found the answer? I read the docs I > found and browsed the archives, but didn't find anything. I'm working > my way to the relevant place in the code, but a nudge would be > useful.) > > thanks, > ts > > _______________________________________________ > SmallWiki, Magritte, Pier and Related Tools ... > https://www.iam.unibe.ch/mailman/listinfo/smallwiki -- www.iam.unibe.ch/~girba www.iam.unibe.ch/~girba/blog/ "Sometimes the best solution is not the best solution." _______________________________________________ SmallWiki, Magritte, Pier and Related Tools ... https://www.iam.unibe.ch/mailman/listinfo/smallwiki |
Thanks Tudor - but that doesn't work, or rather it doesn't do what I
wanted. I already have the unix security installed and setup, but if you make the ('views') component visible only to admin, Pier still shows the box corresponding to the widget, with its title but no commands/views in it (try it!). What I want on the other hand is that the whole widget is absent (since it is empty of functionality now) unless the admin user is logged in. So the question stands: how do I conditionally show a widget such as the commands or views widget in the main environment? Michal _______________________________________________ SmallWiki, Magritte, Pier and Related Tools ... https://www.iam.unibe.ch/mailman/listinfo/smallwiki |
Hi,
The reason for that is that you wrap the Views command with a div, and that div is not affected by the rights of the inner component/ page. For example, by default in Pier you get in the Environment page: <div class="box"><h1>Views</h1>+views+</div> If you want to control the visibility of the surrounding div as well, you can just create a page with only the above content, include the page in the Environment without any surrounding div and then give the page the wanted rights. Cheers, Doru On Oct 14, 2007, at 12:55 PM, [hidden email] wrote: > Thanks Tudor - but that doesn't work, or rather it doesn't do what I > wanted. > > I already have the unix security installed and setup, but if you make > the ('views') component visible only to admin, Pier still shows the > box corresponding to the widget, with its title but no commands/views > in it (try it!). What I want on the other hand is that the whole > widget is absent (since it is empty of functionality now) unless the > admin user is logged in. > > So the question stands: how do I conditionally show a widget such as > the commands or views widget in the main environment? > > Michal > > _______________________________________________ > SmallWiki, Magritte, Pier and Related Tools ... > https://www.iam.unibe.ch/mailman/listinfo/smallwiki -- www.iam.unibe.ch/~girba www.iam.unibe.ch/~girba/blog/ "Problem solving efficiency grows with the abstractness level of problem understanding." _______________________________________________ SmallWiki, Magritte, Pier and Related Tools ... https://www.iam.unibe.ch/mailman/listinfo/smallwiki |
Thanks Tudor - that's clever and elegant! > If you want to control the visibility of the surrounding div as well, > you can just create a page with only the above content, include the > page in the Environment without any surrounding div and then give the > page the wanted rights. _______________________________________________ SmallWiki, Magritte, Pier and Related Tools ... https://www.iam.unibe.ch/mailman/listinfo/smallwiki |
Free forum by Nabble | Edit this page |