001    package org.apache.archiva.security.common;
002    
003    /*
004     * Licensed to the Apache Software Foundation (ASF) under one
005     * or more contributor license agreements.  See the NOTICE file
006     * distributed with this work for additional information
007     * regarding copyright ownership.  The ASF licenses this file
008     * to you under the Apache License, Version 2.0 (the
009     * "License"); you may not use this file except in compliance
010     * with the License.  You may obtain a copy of the License at
011     *
012     *   http://www.apache.org/licenses/LICENSE-2.0
013     *
014     * Unless required by applicable law or agreed to in writing,
015     * software distributed under the License is distributed on an
016     * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
017     * KIND, either express or implied.  See the License for the
018     * specific language governing permissions and limitations
019     * under the License.
020     */
021    
022    public class ArchivaRoleConstants
023    {
024        public static final String DELIMITER = " - ";
025    
026        // globalish roles
027        public static final String SYSTEM_ADMINISTRATOR_ROLE = "System Administrator";
028    
029        public static final String USER_ADMINISTRATOR_ROLE = "User Administrator";
030        
031        public static final String GLOBAL_REPOSITORY_MANAGER_ROLE = "Global Repository Manager";
032    
033        public static final String GLOBAL_REPOSITORY_OBSERVER_ROLE = "Global Repository Observer";
034        
035        public static final String REGISTERED_USER_ROLE = "Registered User";
036    
037        public static final String GUEST_ROLE = "Guest";
038        
039        // dynamic role prefixes
040        public static final String REPOSITORY_MANAGER_ROLE_PREFIX = "Repository Manager";
041    
042        public static final String REPOSITORY_OBSERVER_ROLE_PREFIX = "Repository Observer";
043    
044        // operations
045        public static final String OPERATION_MANAGE_USERS = "archiva-manage-users";
046    
047        public static final String OPERATION_MANAGE_CONFIGURATION = "archiva-manage-configuration";
048    
049        public static final String OPERATION_ACTIVE_GUEST = "archiva-guest";
050    
051        public static final String OPERATION_RUN_INDEXER = "archiva-run-indexer";
052    
053        public static final String OPERATION_REGENERATE_INDEX = "archiva-regenerate-index";
054    
055        public static final String OPERATION_ACCESS_REPORT = "archiva-access-reports";
056    
057        public static final String OPERATION_ADD_REPOSITORY = "archiva-add-repository";
058    
059        public static final String OPERATION_REPOSITORY_ACCESS = "archiva-read-repository";
060    
061        public static final String OPERATION_DELETE_REPOSITORY = "archiva-delete-repository";
062    
063        public static final String OPERATION_EDIT_REPOSITORY = "archiva-edit-repository";
064    
065        public static final String OPERATION_REPOSITORY_UPLOAD = "archiva-upload-repository";
066    
067        public static final String OPERATION_REPOSITORY_DELETE = "archiva-delete-artifact";
068    
069        public static final String OPERATION_MERGE_REPOSITORY = "archiva-merge-repository";
070        
071        public static final String OPERATION_VIEW_AUDIT_LOG = "archiva-view-audit-logs";
072    
073        // Role templates
074        public static final String TEMPLATE_REPOSITORY_MANAGER = "archiva-repository-manager";
075        
076        public static final String TEMPLATE_REPOSITORY_OBSERVER = "archiva-repository-observer";
077        
078        public static final String TEMPLATE_GLOBAL_REPOSITORY_OBSERVER = "archiva-global-repository-observer"; 
079        
080        public static final String TEMPLATE_SYSTEM_ADMIN = "archiva-system-administrator";
081        
082        public static final String TEMPLATE_GUEST = "archiva-guest";
083        
084        public static String toRepositoryObserverRoleName( String repoId )
085        {
086            return REPOSITORY_OBSERVER_ROLE_PREFIX + " - " + repoId;
087        }
088    }