Revision 41748

View differences:

trunk/org.gvsig.desktop/org.gvsig.desktop.framework/org.gvsig.andami/src/main/java/org/gvsig/andami/actioninfo/impl/DefaultActionInfoStatusCache.java
30 30
import org.gvsig.andami.actioninfo.ActionInfoStatusCache;
31 31
import org.gvsig.andami.plugins.ExtensionHelper;
32 32
import org.gvsig.andami.plugins.IExtension;
33
import org.gvsig.tools.ToolsLocator;
34
import org.gvsig.tools.identitymanagement.SimpleIdentity;
35
import org.gvsig.tools.identitymanagement.SimpleIdentityManager;
33 36

  
34 37
public class DefaultActionInfoStatusCache implements ActionInfoStatusCache {
35 38

  
36
	private class Status {
39
        private SimpleIdentityManager identityManager;
40

  
41
        private class Status {
37 42
		Boolean isEnabled = null;
38 43
		Boolean isVisible = null;
39 44
	}
......
50 55
		actions = new HashMap<ActionInfo, Status>();
51 56
	}
52 57
	
58
        private SimpleIdentityManager getIdentityManager() {
59
            if( this.identityManager == null ) {
60
                this.identityManager = ToolsLocator.getIdentityManager();
61
            }
62
            return this.identityManager;
63
        }
53 64

  
65
        private SimpleIdentity getCurrentUser() {
66
            return this.getIdentityManager().getCurrentIdentity();
67
        }
68

  
54 69
	public boolean isEnabled(ActionInfo action) {
55
		Status status; 
70
                if( !this.getCurrentUser().isAuthorized(action.getName()) ) {
71
                    return false;
72
                }
73
                Status status; 
56 74
		IExtension extension = action.getExtension();
57 75
		if( extension == null ) {
58 76
			return false;
......
80 98
	}
81 99

  
82 100
	public boolean isVisible(ActionInfo action) {
83
		Status status; 
101
                if( !this.getCurrentUser().isAuthorized(action.getName()) ) {
102
                    return false;
103
                }
104
                Status status; 
84 105
		IExtension extension = action.getExtension();
85 106
		if( extension == null ) {
86 107
			return false;

Also available in: Unified diff