Project

General

Profile

Revision 44b9dbd2

ID44b9dbd272fa544727f2b09a9f14e72f27d2ecdc
Parent 877a8283
Child 845ce635

Added by Andreas Kohlbecker over 2 years ago

ref #7359 setting editor readonly after bean has set

View differences:

src/main/java/eu/etaxonomy/vaadin/mvp/AbstractCdmEditorPresenter.java
87 87
                guaranteePerEntityCRUDPermissions(cdmEntitiy);
88 88
            }
89 89
        }
90
        adaptToUserPermission(cdmEntitiy);
91 90
        cache = new CdmTransientEntityCacher(this);
92 91
        // need to use load but put see #7214
93 92
        cdmEntitiy = cache.load(cdmEntitiy);
......
99 98
    /**
100 99
     * @param cdmEntitiy
101 100
     */
102
    private void adaptToUserPermission(DTO cdmEntitiy) {
101
    @Override
102
    protected void adaptToUserPermission(DTO cdmEntitiy) {
103 103
        UserHelper userHelper = UserHelper.fromSession();
104 104
        boolean canDelte = userHelper.userHasPermission(cdmEntitiy, CRUD.DELETE);
105 105
        boolean canEdit = userHelper.userHasPermission(cdmEntitiy, CRUD.UPDATE);
src/main/java/eu/etaxonomy/vaadin/mvp/AbstractEditorPresenter.java
47 47
    protected abstract DTO loadBeanById(Object identifier);
48 48

  
49 49
    /**
50
     * Set ui elements to readonly or disabled to adapt the editor to
51
     * the permissions that are given to the current user etc.
52
     *
53
     * @param beanToEdit
54
     */
55
    protected void adaptToUserPermission(DTO beanToEdit) {
56

  
57
    }
58

  
59
    /**
50 60
     * @param beanInstantiator the beanInstantiator to set
51 61
     */
52 62
    public void setBeanInstantiator(BeanInstantiator<DTO> beanInstantiator) {
src/main/java/eu/etaxonomy/vaadin/mvp/AbstractPopupEditor.java
560 560
        DTO beanToEdit = getPresenter().loadBeanById(identifier);
561 561
        fieldGroup.setItemDataSource(beanToEdit);
562 562
        afterItemDataSourceSet();
563
        getPresenter().adaptToUserPermission(beanToEdit);
563 564
        isBeanLoaded = true;
564 565
    }
565 566

  

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)