Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Riena » Create Application model depending on login information
Create Application model depending on login information [message #23776] Mon, 30 March 2009 07:44 Go to next message
Carsten Spieker is currently offline Carsten SpiekerFriend
Messages: 197
Registered: July 2009
Senior Member
Hi,

I want to create my application model depending on the current users
permissions.

The problem is that IApplicationNode.createModel() is called before login
has been performed.

Is there any possibility to manipulate the displayed model nodes after
login? Or is there any out of the box solution for this?

Thanks and greetz,
Carsten
Re: Create Application model depending on login information [message #23906 is a reply to message #23776] Mon, 30 March 2009 15:52 Go to previous messageGo to next message
Frank Schepp is currently offline Frank ScheppFriend
Messages: 14
Registered: July 2009
Junior Member
Hi Carsten,

you are right in case you use the splash login view (its different for
the login dialog view). The splash login view is brought up when the
workbench is created and that is after createModel() was called. I think
you can use the riena ui filters (see
http://wiki.eclipse.org/Riena_UI_filters) to manipulate the displayed
model nodes based on permissions. Override the createView() method of
your application class (subclass of SwtApplication) like this:

@Override
public Object createView(IApplicationContext context, IApplicationNode
pNode) {
Collection<IUIFilterRule> rules = new ArrayList<IUIFilterRule>(1);

// hidden marker for all children of application node
IUIFilterRule filterRule = new UIFilterRuleNavigationHiddenMarker("/"
+ pNode.getNodeId().getTypeId() + "/*") {
@Override
public boolean matches(Object... args) {
return super.matches(args) && !getPermission(args);
}

private boolean getPermission(Object... args) {
boolean permission = true;
if (args[0] instanceof INavigationNode<?>) {
permission = // get permission for node (args[0])
}

return permission;
}
};
rules.add(filterRule);
IUIFilter filter = new UIFilter(rules);
pNode.addFilter(filter);

return super.createView(context, pNode);
}

Also there is an API method setVisible() in INavigationNode to set the
visibility of a node.

Regards, Frank

Carsten Spieker wrote:
> Hi,
>
> I want to create my application model depending on the current users
> permissions.
>
> The problem is that IApplicationNode.createModel() is called before login
> has been performed.
>
> Is there any possibility to manipulate the displayed model nodes after
> login? Or is there any out of the box solution for this?
>
> Thanks and greetz,
> Carsten
>
>
Re: Create Application model depending on login information [message #24021 is a reply to message #23906] Wed, 01 April 2009 07:08 Go to previous messageGo to next message
Carsten Spieker is currently offline Carsten SpiekerFriend
Messages: 197
Registered: July 2009
Senior Member
Hi Frank,

thanks for your reply!

I tried the way you explained via the UIFilter. Unfortunately I have two
problems with this solution:

1) The class UIFilterRuleNavigationHiddenMarker seems to be internal.
2) The UI shows a bad looking gray "placeholder" where the now hidden
navigation node was displayed before until I "click" somewhere in the UI
(maybe this is only a refresh problem?)

Greetz,
Carsten


"Frank Schepp" <Frank.Schepp@compeople.de> schrieb im Newsbeitrag
news:gqqqia$un0$1@build.eclipse.org...
> Hi Carsten,
>
> you are right in case you use the splash login view (its different for the
> login dialog view). The splash login view is brought up when the workbench
> is created and that is after createModel() was called. I think you can use
> the riena ui filters (see http://wiki.eclipse.org/Riena_UI_filters) to
> manipulate the displayed model nodes based on permissions. Override the
> createView() method of your application class (subclass of SwtApplication)
> like this:
>
> @Override
> public Object createView(IApplicationContext context, IApplicationNode
> pNode) {
> Collection<IUIFilterRule> rules = new ArrayList<IUIFilterRule>(1);
>
> // hidden marker for all children of application node
> IUIFilterRule filterRule = new UIFilterRuleNavigationHiddenMarker("/" +
> pNode.getNodeId().getTypeId() + "/*") {
> @Override
> public boolean matches(Object... args) {
> return super.matches(args) && !getPermission(args);
> }
>
> private boolean getPermission(Object... args) {
> boolean permission = true;
> if (args[0] instanceof INavigationNode<?>) {
> permission = // get permission for node (args[0])
> }
>
> return permission;
> }
> };
> rules.add(filterRule);
> IUIFilter filter = new UIFilter(rules);
> pNode.addFilter(filter);
>
> return super.createView(context, pNode);
> }
>
> Also there is an API method setVisible() in INavigationNode to set the
> visibility of a node.
>
> Regards, Frank
>
> Carsten Spieker wrote:
>> Hi,
>>
>> I want to create my application model depending on the current users
>> permissions.
>>
>> The problem is that IApplicationNode.createModel() is called before login
>> has been performed.
>>
>> Is there any possibility to manipulate the displayed model nodes after
>> login? Or is there any out of the box solution for this?
>>
>> Thanks and greetz,
>> Carsten
Re: Create Application model depending on login information [message #24053 is a reply to message #24021] Wed, 01 April 2009 08:57 Go to previous messageGo to next message
Frank Schepp is currently offline Frank ScheppFriend
Messages: 14
Registered: July 2009
Junior Member
Hi Carsten,

you are right class UIFilterRuleNavigationHiddenMarker is internal and
so should be used only with caution, because this code may undergo
changes. May be you file a bugzilla request which describes your problem
and mentions that class UIFilterRuleNavigationHiddenMarker is internal.
The gray "placeholder" seems to be a refresh problem. Can you file
bugzilla request for that? Is it a submodule your are hiding?

Regards, Frank

Carsten Spieker wrote:
> Hi Frank,
>
> thanks for your reply!
>
> I tried the way you explained via the UIFilter. Unfortunately I have two
> problems with this solution:
>
> 1) The class UIFilterRuleNavigationHiddenMarker seems to be internal.
> 2) The UI shows a bad looking gray "placeholder" where the now hidden
> navigation node was displayed before until I "click" somewhere in the UI
> (maybe this is only a refresh problem?)
>
> Greetz,
> Carsten
>
>
> "Frank Schepp" <Frank.Schepp@compeople.de> schrieb im Newsbeitrag
> news:gqqqia$un0$1@build.eclipse.org...
>> Hi Carsten,
>>
>> you are right in case you use the splash login view (its different for the
>> login dialog view). The splash login view is brought up when the workbench
>> is created and that is after createModel() was called. I think you can use
>> the riena ui filters (see http://wiki.eclipse.org/Riena_UI_filters) to
>> manipulate the displayed model nodes based on permissions. Override the
>> createView() method of your application class (subclass of SwtApplication)
>> like this:
>>
>> @Override
>> public Object createView(IApplicationContext context, IApplicationNode
>> pNode) {
>> Collection<IUIFilterRule> rules = new ArrayList<IUIFilterRule>(1);
>>
>> // hidden marker for all children of application node
>> IUIFilterRule filterRule = new UIFilterRuleNavigationHiddenMarker("/" +
>> pNode.getNodeId().getTypeId() + "/*") {
>> @Override
>> public boolean matches(Object... args) {
>> return super.matches(args) && !getPermission(args);
>> }
>>
>> private boolean getPermission(Object... args) {
>> boolean permission = true;
>> if (args[0] instanceof INavigationNode<?>) {
>> permission = // get permission for node (args[0])
>> }
>>
>> return permission;
>> }
>> };
>> rules.add(filterRule);
>> IUIFilter filter = new UIFilter(rules);
>> pNode.addFilter(filter);
>>
>> return super.createView(context, pNode);
>> }
>>
>> Also there is an API method setVisible() in INavigationNode to set the
>> visibility of a node.
>>
>> Regards, Frank
>>
>> Carsten Spieker wrote:
>>> Hi,
>>>
>>> I want to create my application model depending on the current users
>>> permissions.
>>>
>>> The problem is that IApplicationNode.createModel() is called before login
>>> has been performed.
>>>
>>> Is there any possibility to manipulate the displayed model nodes after
>>> login? Or is there any out of the box solution for this?
>>>
>>> Thanks and greetz,
>>> Carsten
>
>
Re: Create Application model depending on login information [message #24153 is a reply to message #24053] Wed, 01 April 2009 09:46 Go to previous message
Carsten Spieker is currently offline Carsten SpiekerFriend
Messages: 197
Registered: July 2009
Senior Member
Hi Frank,

I opened Bug report 270735 for this.

Greetz,
Carsten


"Frank Schepp" <Frank.Schepp@compeople.de> schrieb im Newsbeitrag
news:gqvavi$9fi$1@build.eclipse.org...
> Hi Carsten,
>
> you are right class UIFilterRuleNavigationHiddenMarker is internal and so
> should be used only with caution, because this code may undergo changes.
> May be you file a bugzilla request which describes your problem and
> mentions that class UIFilterRuleNavigationHiddenMarker is internal. The
> gray "placeholder" seems to be a refresh problem. Can you file bugzilla
> request for that? Is it a submodule your are hiding?
>
> Regards, Frank
>
> Carsten Spieker wrote:
>> Hi Frank,
>>
>> thanks for your reply!
>>
>> I tried the way you explained via the UIFilter. Unfortunately I have two
>> problems with this solution:
>>
>> 1) The class UIFilterRuleNavigationHiddenMarker seems to be internal.
>> 2) The UI shows a bad looking gray "placeholder" where the now hidden
>> navigation node was displayed before until I "click" somewhere in the UI
>> (maybe this is only a refresh problem?)
>>
>> Greetz,
>> Carsten
>>
>>
>> "Frank Schepp" <Frank.Schepp@compeople.de> schrieb im Newsbeitrag
>> news:gqqqia$un0$1@build.eclipse.org...
>>> Hi Carsten,
>>>
>>> you are right in case you use the splash login view (its different for
>>> the login dialog view). The splash login view is brought up when the
>>> workbench is created and that is after createModel() was called. I think
>>> you can use the riena ui filters (see
>>> http://wiki.eclipse.org/Riena_UI_filters) to manipulate the displayed
>>> model nodes based on permissions. Override the createView() method of
>>> your application class (subclass of SwtApplication) like this:
>>>
>>> @Override
>>> public Object createView(IApplicationContext context, IApplicationNode
>>> pNode) {
>>> Collection<IUIFilterRule> rules = new ArrayList<IUIFilterRule>(1);
>>>
>>> // hidden marker for all children of application node
>>> IUIFilterRule filterRule = new UIFilterRuleNavigationHiddenMarker("/"
>>> + pNode.getNodeId().getTypeId() + "/*") {
>>> @Override
>>> public boolean matches(Object... args) {
>>> return super.matches(args) && !getPermission(args);
>>> }
>>>
>>> private boolean getPermission(Object... args) {
>>> boolean permission = true;
>>> if (args[0] instanceof INavigationNode<?>) {
>>> permission = // get permission for node (args[0])
>>> }
>>>
>>> return permission;
>>> }
>>> };
>>> rules.add(filterRule);
>>> IUIFilter filter = new UIFilter(rules);
>>> pNode.addFilter(filter);
>>>
>>> return super.createView(context, pNode);
>>> }
>>>
>>> Also there is an API method setVisible() in INavigationNode to set the
>>> visibility of a node.
>>>
>>> Regards, Frank
>>>
>>> Carsten Spieker wrote:
>>>> Hi,
>>>>
>>>> I want to create my application model depending on the current users
>>>> permissions.
>>>>
>>>> The problem is that IApplicationNode.createModel() is called before
>>>> login has been performed.
>>>>
>>>> Is there any possibility to manipulate the displayed model nodes after
>>>> login? Or is there any out of the box solution for this?
>>>>
>>>> Thanks and greetz,
>>>> Carsten
>>
Re: Create Application model depending on login information [message #581599 is a reply to message #23776] Mon, 30 March 2009 15:52 Go to previous message
Frank Schepp is currently offline Frank ScheppFriend
Messages: 14
Registered: July 2009
Junior Member
Hi Carsten,

you are right in case you use the splash login view (its different for
the login dialog view). The splash login view is brought up when the
workbench is created and that is after createModel() was called. I think
you can use the riena ui filters (see
http://wiki.eclipse.org/Riena_UI_filters) to manipulate the displayed
model nodes based on permissions. Override the createView() method of
your application class (subclass of SwtApplication) like this:

@Override
public Object createView(IApplicationContext context, IApplicationNode
pNode) {
Collection<IUIFilterRule> rules = new ArrayList<IUIFilterRule>(1);

// hidden marker for all children of application node
IUIFilterRule filterRule = new UIFilterRuleNavigationHiddenMarker("/"
+ pNode.getNodeId().getTypeId() + "/*") {
@Override
public boolean matches(Object... args) {
return super.matches(args) && !getPermission(args);
}

private boolean getPermission(Object... args) {
boolean permission = true;
if (args[0] instanceof INavigationNode<?>) {
permission = // get permission for node (args[0])
}

return permission;
}
};
rules.add(filterRule);
IUIFilter filter = new UIFilter(rules);
pNode.addFilter(filter);

return super.createView(context, pNode);
}

Also there is an API method setVisible() in INavigationNode to set the
visibility of a node.

Regards, Frank

Carsten Spieker wrote:
> Hi,
>
> I want to create my application model depending on the current users
> permissions.
>
> The problem is that IApplicationNode.createModel() is called before login
> has been performed.
>
> Is there any possibility to manipulate the displayed model nodes after
> login? Or is there any out of the box solution for this?
>
> Thanks and greetz,
> Carsten
>
>
Re: Create Application model depending on login information [message #581645 is a reply to message #23906] Wed, 01 April 2009 07:08 Go to previous message
Carsten Spieker is currently offline Carsten SpiekerFriend
Messages: 197
Registered: July 2009
Senior Member
Hi Frank,

thanks for your reply!

I tried the way you explained via the UIFilter. Unfortunately I have two
problems with this solution:

1) The class UIFilterRuleNavigationHiddenMarker seems to be internal.
2) The UI shows a bad looking gray "placeholder" where the now hidden
navigation node was displayed before until I "click" somewhere in the UI
(maybe this is only a refresh problem?)

Greetz,
Carsten


"Frank Schepp" <Frank.Schepp@compeople.de> schrieb im Newsbeitrag
news:gqqqia$un0$1@build.eclipse.org...
> Hi Carsten,
>
> you are right in case you use the splash login view (its different for the
> login dialog view). The splash login view is brought up when the workbench
> is created and that is after createModel() was called. I think you can use
> the riena ui filters (see http://wiki.eclipse.org/Riena_UI_filters) to
> manipulate the displayed model nodes based on permissions. Override the
> createView() method of your application class (subclass of SwtApplication)
> like this:
>
> @Override
> public Object createView(IApplicationContext context, IApplicationNode
> pNode) {
> Collection<IUIFilterRule> rules = new ArrayList<IUIFilterRule>(1);
>
> // hidden marker for all children of application node
> IUIFilterRule filterRule = new UIFilterRuleNavigationHiddenMarker("/" +
> pNode.getNodeId().getTypeId() + "/*") {
> @Override
> public boolean matches(Object... args) {
> return super.matches(args) && !getPermission(args);
> }
>
> private boolean getPermission(Object... args) {
> boolean permission = true;
> if (args[0] instanceof INavigationNode<?>) {
> permission = // get permission for node (args[0])
> }
>
> return permission;
> }
> };
> rules.add(filterRule);
> IUIFilter filter = new UIFilter(rules);
> pNode.addFilter(filter);
>
> return super.createView(context, pNode);
> }
>
> Also there is an API method setVisible() in INavigationNode to set the
> visibility of a node.
>
> Regards, Frank
>
> Carsten Spieker wrote:
>> Hi,
>>
>> I want to create my application model depending on the current users
>> permissions.
>>
>> The problem is that IApplicationNode.createModel() is called before login
>> has been performed.
>>
>> Is there any possibility to manipulate the displayed model nodes after
>> login? Or is there any out of the box solution for this?
>>
>> Thanks and greetz,
>> Carsten
Re: Create Application model depending on login information [message #581655 is a reply to message #24021] Wed, 01 April 2009 08:57 Go to previous message
Frank Schepp is currently offline Frank ScheppFriend
Messages: 14
Registered: July 2009
Junior Member
Hi Carsten,

you are right class UIFilterRuleNavigationHiddenMarker is internal and
so should be used only with caution, because this code may undergo
changes. May be you file a bugzilla request which describes your problem
and mentions that class UIFilterRuleNavigationHiddenMarker is internal.
The gray "placeholder" seems to be a refresh problem. Can you file
bugzilla request for that? Is it a submodule your are hiding?

Regards, Frank

Carsten Spieker wrote:
> Hi Frank,
>
> thanks for your reply!
>
> I tried the way you explained via the UIFilter. Unfortunately I have two
> problems with this solution:
>
> 1) The class UIFilterRuleNavigationHiddenMarker seems to be internal.
> 2) The UI shows a bad looking gray "placeholder" where the now hidden
> navigation node was displayed before until I "click" somewhere in the UI
> (maybe this is only a refresh problem?)
>
> Greetz,
> Carsten
>
>
> "Frank Schepp" <Frank.Schepp@compeople.de> schrieb im Newsbeitrag
> news:gqqqia$un0$1@build.eclipse.org...
>> Hi Carsten,
>>
>> you are right in case you use the splash login view (its different for the
>> login dialog view). The splash login view is brought up when the workbench
>> is created and that is after createModel() was called. I think you can use
>> the riena ui filters (see http://wiki.eclipse.org/Riena_UI_filters) to
>> manipulate the displayed model nodes based on permissions. Override the
>> createView() method of your application class (subclass of SwtApplication)
>> like this:
>>
>> @Override
>> public Object createView(IApplicationContext context, IApplicationNode
>> pNode) {
>> Collection<IUIFilterRule> rules = new ArrayList<IUIFilterRule>(1);
>>
>> // hidden marker for all children of application node
>> IUIFilterRule filterRule = new UIFilterRuleNavigationHiddenMarker("/" +
>> pNode.getNodeId().getTypeId() + "/*") {
>> @Override
>> public boolean matches(Object... args) {
>> return super.matches(args) && !getPermission(args);
>> }
>>
>> private boolean getPermission(Object... args) {
>> boolean permission = true;
>> if (args[0] instanceof INavigationNode<?>) {
>> permission = // get permission for node (args[0])
>> }
>>
>> return permission;
>> }
>> };
>> rules.add(filterRule);
>> IUIFilter filter = new UIFilter(rules);
>> pNode.addFilter(filter);
>>
>> return super.createView(context, pNode);
>> }
>>
>> Also there is an API method setVisible() in INavigationNode to set the
>> visibility of a node.
>>
>> Regards, Frank
>>
>> Carsten Spieker wrote:
>>> Hi,
>>>
>>> I want to create my application model depending on the current users
>>> permissions.
>>>
>>> The problem is that IApplicationNode.createModel() is called before login
>>> has been performed.
>>>
>>> Is there any possibility to manipulate the displayed model nodes after
>>> login? Or is there any out of the box solution for this?
>>>
>>> Thanks and greetz,
>>> Carsten
>
>
Re: Create Application model depending on login information [message #581668 is a reply to message #24053] Wed, 01 April 2009 09:46 Go to previous message
Carsten Spieker is currently offline Carsten SpiekerFriend
Messages: 197
Registered: July 2009
Senior Member
Hi Frank,

I opened Bug report 270735 for this.

Greetz,
Carsten


"Frank Schepp" <Frank.Schepp@compeople.de> schrieb im Newsbeitrag
news:gqvavi$9fi$1@build.eclipse.org...
> Hi Carsten,
>
> you are right class UIFilterRuleNavigationHiddenMarker is internal and so
> should be used only with caution, because this code may undergo changes.
> May be you file a bugzilla request which describes your problem and
> mentions that class UIFilterRuleNavigationHiddenMarker is internal. The
> gray "placeholder" seems to be a refresh problem. Can you file bugzilla
> request for that? Is it a submodule your are hiding?
>
> Regards, Frank
>
> Carsten Spieker wrote:
>> Hi Frank,
>>
>> thanks for your reply!
>>
>> I tried the way you explained via the UIFilter. Unfortunately I have two
>> problems with this solution:
>>
>> 1) The class UIFilterRuleNavigationHiddenMarker seems to be internal.
>> 2) The UI shows a bad looking gray "placeholder" where the now hidden
>> navigation node was displayed before until I "click" somewhere in the UI
>> (maybe this is only a refresh problem?)
>>
>> Greetz,
>> Carsten
>>
>>
>> "Frank Schepp" <Frank.Schepp@compeople.de> schrieb im Newsbeitrag
>> news:gqqqia$un0$1@build.eclipse.org...
>>> Hi Carsten,
>>>
>>> you are right in case you use the splash login view (its different for
>>> the login dialog view). The splash login view is brought up when the
>>> workbench is created and that is after createModel() was called. I think
>>> you can use the riena ui filters (see
>>> http://wiki.eclipse.org/Riena_UI_filters) to manipulate the displayed
>>> model nodes based on permissions. Override the createView() method of
>>> your application class (subclass of SwtApplication) like this:
>>>
>>> @Override
>>> public Object createView(IApplicationContext context, IApplicationNode
>>> pNode) {
>>> Collection<IUIFilterRule> rules = new ArrayList<IUIFilterRule>(1);
>>>
>>> // hidden marker for all children of application node
>>> IUIFilterRule filterRule = new UIFilterRuleNavigationHiddenMarker("/"
>>> + pNode.getNodeId().getTypeId() + "/*") {
>>> @Override
>>> public boolean matches(Object... args) {
>>> return super.matches(args) && !getPermission(args);
>>> }
>>>
>>> private boolean getPermission(Object... args) {
>>> boolean permission = true;
>>> if (args[0] instanceof INavigationNode<?>) {
>>> permission = // get permission for node (args[0])
>>> }
>>>
>>> return permission;
>>> }
>>> };
>>> rules.add(filterRule);
>>> IUIFilter filter = new UIFilter(rules);
>>> pNode.addFilter(filter);
>>>
>>> return super.createView(context, pNode);
>>> }
>>>
>>> Also there is an API method setVisible() in INavigationNode to set the
>>> visibility of a node.
>>>
>>> Regards, Frank
>>>
>>> Carsten Spieker wrote:
>>>> Hi,
>>>>
>>>> I want to create my application model depending on the current users
>>>> permissions.
>>>>
>>>> The problem is that IApplicationNode.createModel() is called before
>>>> login has been performed.
>>>>
>>>> Is there any possibility to manipulate the displayed model nodes after
>>>> login? Or is there any out of the box solution for this?
>>>>
>>>> Thanks and greetz,
>>>> Carsten
>>
Previous Topic:Authorizarion Service on client side causes problems
Next Topic:Authorizarion Service on client side causes problems
Goto Forum:
  


Current Time: Fri Apr 19 23:26:44 GMT 2024

Powered by FUDForum. Page generated in 0.03528 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top