[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [equinox-dev] Restrict access to view depending on a user profile
|
You have a couple of options in this case. All referenced examples
will be from my own private stash because it's Boxing Day and I'm too
lazy to look anything up. ;)
First off, the transformation work I did isn't really suited for this
problem. You're looking at altering the runtime dynamically while
it's engaged. The transformer stuff works primarily at startup.
While you could certainly write a transformer that supplied dynamic
content you would also have to have it tweak all places that use the
content for a refresh (providing they supported that at all). For
instance, you can transform the plug-in XMLs in your bundles but once
the extension registry has read them you'll need to run with -clean
to flush the extension cache - they wont reprocess the files if you
dont.
The first (and easiest) option is to define a set of activities to
filter components for you. See http://eclipse.pookzilla.net/2006/10/
context-capability-and-perspective.php for some details on how to
define the activities. Basically you'd hook up your user log in
(whatever that happens to be) to activate or deactivate activities as
appropriate. I threw together a simple example for Eclipsecon 2004
that shows how activities can be used in this way. Take a look at
http://dev.eclipse.org/viewcvs/index.cgi/platform-ui-home/eclipsecon/
activities/EclipseCon2005.KCH.AuthDemo/ for this.
The other option would be to partition your view contributions such
that the plug-ins that contain them can be loaded and unloaded when
users log in and out. With the above solution the views you're
trying to hide are still in the system - while no UI that we provide
will ever show them its still possible to activate them via API.
With this solution the plug-ins will really disappear. I have some
code that shows how to load and unload bundles dynamically located at
http://pookzilla.net/dynamic/dynamic.zip that should be able to help
you with this. Basically you'd need to establish a set of baseline
plug-ins that should be in the system prior to any user
authentication. When a user logs in you load all bundles associated
with them and when they log out you revert such that only the
baseline plug-ins are active. Extensions in the UI workbench plug-in
will respect dynamic loading and unloading by default - this includes
views, editors, actions, preference pages, etc. Any extension point
you write would have support dynamic loading and unloading as well -
a start point for this can be found at http://eclipse.pookzilla.net/
2005/03/supporting-dynamic-bundle-loading-in.php
I hope that was helpful.
On Dec 25, 2006, at 5:27 PM, zouaoui anis wrote:
Hi,
I'm trying to restrict access to some views on my RCP application
depending on user profile, users can have access to perspectives but
not to one view of the perspective.
I've tried with the ExtensionRegistry.removeExtension (...) method but
I found that with non master token I can just add/remove "non
persisted" extension from the ExtensionRegistry.
I sow that Eclipse 3.3 propose XSLT transformation on the OSGI Level
to filter the plugin.xml file, but it still in the incubator stage,
Is there any other "Eclipse compatible" way to restrict access to
my views ?
Regards,
Anis
_______________________________________________
equinox-dev mailing list
equinox-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/equinox-dev