Project

General

Profile

« Previous | Next » 

Revision 57178b7f

Added by Andreas Kohlbecker over 6 years ago

ref #7150 implementing CollectionVoter and adding new default PermissionGroup 'EditorExtendedCreate'

View differences:

cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/application/FirstDataInserter.java
18 18
import org.apache.log4j.Logger;
19 19
import org.springframework.beans.factory.annotation.Autowired;
20 20
import org.springframework.context.event.ContextRefreshedEvent;
21
import org.springframework.context.event.ContextStartedEvent;
22 21
import org.springframework.security.authentication.AuthenticationProvider;
23 22
import org.springframework.security.core.GrantedAuthority;
24 23
import org.springframework.transaction.PlatformTransactionManager;
......
89 88
            new CdmAuthority(CdmPermissionClass.DESCRIPTIONBASE, CREATE_READ_UPDATE_DELETE).toString(),
90 89
            new CdmAuthority(CdmPermissionClass.DESCRIPTIONELEMENTBASE, CREATE_READ_UPDATE_DELETE).toString(),
91 90
            new CdmAuthority(CdmPermissionClass.SPECIMENOROBSERVATIONBASE, CREATE_READ_UPDATE_DELETE).toString(),
91
            new CdmAuthority(CdmPermissionClass.COLLECTION, CREATE_READ_UPDATE_DELETE).toString(),
92
    };
93

  
94
    /**
95
     * This group will in future replace the group Editor, see issue #7150
96
     */
97
    public static final String[] EDITOR_GROUP_EXTENDED_CREATE_GROUP_AUTHORITIES = new String[]{
98
            new CdmAuthority(CdmPermissionClass.REFERENCE, CREATE_READ).toString(),
99
            new CdmAuthority(CdmPermissionClass.TAXONNAME, CREATE_READ).toString(),
100
            new CdmAuthority(CdmPermissionClass.TEAMORPERSONBASE, CREATE_READ).toString(),
101
            new CdmAuthority(CdmPermissionClass.TAXONBASE, CREATE_READ).toString(),
102
            new CdmAuthority(CdmPermissionClass.DESCRIPTIONBASE, CREATE_READ).toString(),
103
            new CdmAuthority(CdmPermissionClass.DESCRIPTIONELEMENTBASE, CREATE_READ).toString(),
104
            new CdmAuthority(CdmPermissionClass.SPECIMENOROBSERVATIONBASE, CREATE_READ).toString(),
105
            new CdmAuthority(CdmPermissionClass.COLLECTION, CREATE_READ).toString(),
92 106
    };
93 107

  
94 108
    public static final String[] PROJECT_MANAGER_GROUP_AUTHORITIES = new String[]{
......
205 219
    private void checkDefaultGroups(){
206 220

  
207 221
        progressMonitor.subTask("Checking default groups");
208
        checkGroup(Group.GROUP_EDITOR_UUID, "Editor", EDITOR_GROUP_AUTHORITIES);
209
        checkGroup(Group.GROUP_PROJECT_MANAGER_UUID, "ProjectManager", PROJECT_MANAGER_GROUP_AUTHORITIES);
210
        checkGroup(Group.GROUP_ADMIN_UUID, "Admin", ADMIN_GROUP_AUTHORITIES);
222
        checkGroup(Group.GROUP_EDITOR_UUID, Group.GROUP_EDITOR_NAME, EDITOR_GROUP_AUTHORITIES);
223
        checkGroup(Group.GROUP_EDITOR_EXTENDED_CREATE_UUID, Group.GROUP_EDITOR_EXTENDED_CREATE_NAME, EDITOR_GROUP_EXTENDED_CREATE_GROUP_AUTHORITIES);
224
        checkGroup(Group.GROUP_PROJECT_MANAGER_UUID, Group.GROUP_PROJECT_MANAGER_NAME, PROJECT_MANAGER_GROUP_AUTHORITIES);
225
        checkGroup(Group.GROUP_ADMIN_UUID, Group.GROUP_ADMIN_NAME, ADMIN_GROUP_AUTHORITIES);
211 226
        progressMonitor.worked(1);
212 227
    }
213 228

  
......
223 238
            group.setUuid(groupUuid);
224 239
            logger.info("New Group '" + groupName + "' created");
225 240
        }
226
        group.setName(groupName); // force name
241
        group.setName(groupName); // force default name
227 242

  
228 243
        Set<GrantedAuthority> grantedAuthorities = group.getGrantedAuthorities();
229 244

  

Also available in: Unified diff