Results 1 to 2 of 2

Thread: Secure localCommands

  1. #1

    Default Secure localCommands

    Hi together,
    in my current project I have a JTree with different nodes. There is a global deleteCommand which is secured with a "writeController". Most of the time this is fine, but actually the delete command depends on the current selection within the tree.

    If the root node is selected, I would secure the delete command with a stronger "adminController" (User has ROLE_ADMIN role).

    My questions:
    1. Should I have different localExecuters for different deleteCommands? Is this actually possible?
    2. How can I change the security of my deleteCommand when changing the selection?


    Thanks in advance
    fritz

  2. #2

    Default

    Cause I couldn't find a solution, I will do it this way, which actually works fine:

    Code:
    private NewFeatureAction getNewFeatureAction(){
    		if (newFeatureCommand == null){
    			newFeatureCommand = new NewFeatureAction();
    			getWindowCommandManager().configure(newFeatureCommand);
    		}
    		return newFeatureCommand;
    	}
    
    private class NewFeatureAction extends ActionCommand {
    		
    		public NewFeatureAction() {
    			super("newFeatureCommand");
    			setSecurityControllerId("adminController");     
            }
    
    		@Override
    		protected void doExecuteCommand() {
    ...
    		}
    }

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •