package org.apache.archiva.web.xmlrpc.security;

/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *  http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */

import java.util.ArrayList;
import java.util.List;

/**
 * ServiceMethodsPermissionsMapping
 *
 * Used by the XmlRpcAuthenticationHandler to check the permissions specific to the requested service method.
 * New methods in exposed services must be registered in the appropriate operation below.
 *
 * @version $Id: ServiceMethodsPermissionsMapping.java
 */
public class ServiceMethodsPermissionsMapping
{
    public static final List<String> SERVICE_METHODS_FOR_OPERATION_MANAGE_CONFIGURATION = new ArrayList<String>()
    {
        {
            add( "AdministrationService.configureRepositoryConsumer" );
            add( "AdministrationService.configureDatabaseConsumer" );
            add( "AdministrationService.executeDatabaseScanner" );
            add( "AdministrationService.getAllManagedRepositories" );
            add( "AdministrationService.getAllRemoteRepositories" );
            add( "AdministrationService.getAllDatabaseConsumers" );
            add( "AdministrationService.getAllRepositoryConsumers" );
            add( "AdministrationService.deleteArtifact" );
        }
    };

    public static final List<String> SERVICE_METHODS_FOR_OPERATION_RUN_INDEXER = new ArrayList<String>()
    {
        {
            add( "AdministrationService.executeRepositoryScanner");
        }
    };

    public static final List<String> SERVICE_METHODS_FOR_OPERATION_ACCESS_REPORT = new ArrayList<String>();

    public static final List<String> SERVICE_METHODS_FOR_OPERATION_REPOSITORY_ACCESS = new ArrayList<String>()
    {
        {
    	    add( "SearchService.quickSearch" );
    	    add( "SearchService.getArtifactByChecksum" );
            add( "SearchService.getArtifactVersions" );
            add( "SearchService.getArtifactVersionsByDate" );
            add( "SearchService.getDependencies" );
            add( "SearchService.getDependencyTree" );
            add( "SearchService.getDependees" );
    	 }
    };

    public static final List<String> SERVICE_METHODS_FOR_OPERATION_ADD_REPOSITORY = new ArrayList<String>();

    public static final List<String> SERVICE_METHODS_FOR_OPERATION_DELETE_REPOSITORY = new ArrayList<String>();

    public static final List<String> SERVICE_METHODS_FOR_OPERATION_EDIT_REPOSITORY = new ArrayList<String>();

    public static final List<String> SERVICE_METHODS_FOR_OPERATION_REPOSITORY_UPLOAD = new ArrayList<String>();

}

@@ -872,20 +872,17 @@
 il.Array
-List
+s
 ;%0Aimport
@@ -1345,64 +1345,30 @@
 ON =
- new ArrayList%3CString%3E()%0A    %7B%0A        %7B%0A            add
+%0A        Arrays.asList
 ( %22A
@@ -1408,36 +1408,41 @@
 ositoryConsumer%22
- );%0A
+,%0A       
             add(
@@ -1429,36 +1429,35 @@
                 
-add(
+   
  %22Administration
@@ -1490,19 +1490,17 @@
 onsumer%22
- );
+,
 %0A       
@@ -1496,36 +1496,42 @@
 r%22,%0A            
-add(
+          
  %22Administration
@@ -1561,20 +1561,28 @@
 Scanner%22
- );%0A
+,%0A          
         
@@ -1577,36 +1577,32 @@
                 
-add(
  %22Administration
@@ -1627,35 +1627,33 @@
 gedRepositories%22
- );
+,
 %0A            add
@@ -1641,36 +1641,42 @@
 s%22,%0A            
-add(
+          
  %22Administration
@@ -1704,27 +1704,25 @@
 epositories%22
- );
+,
 %0A           
@@ -1714,36 +1714,42 @@
 s%22,%0A            
-add(
+          
  %22Administration
@@ -1772,36 +1772,44 @@
 tabaseConsumers%22
- );%0A
+,%0A          
             add(
@@ -1796,36 +1796,32 @@
                 
-add(
  %22Administration
@@ -1854,36 +1854,17 @@
 nsumers%22
- );%0A            add(
+,
  %22Admini
@@ -1897,33 +1897,16 @@
 fact%22 );
-%0A        %7D%0A    %7D;
 %0A%0A    pu
@@ -1983,240 +1983,81 @@
 ER =
- new ArrayList%3CString%3E()%0A    %7B%0A        %7B%0A            add( %22AdministrationService.executeRepositoryScanner%22);%0A        %7D%0A    %7D;%0A%0A    public static final List%3CString%3E SERVICE_METHODS_FOR_OPERATION_ACCESS_REPORT = new ArrayList%3CString%3E(
+%0A        Arrays.asList( %22AdministrationService.executeRepositoryScanner%22 
 );%0A%0A
@@ -2146,61 +2146,30 @@
 SS =
- new ArrayList%3CString%3E()%0A    %7B%0A        %7B%0A    %09    add
+%0A        Arrays.asList
 ( %22S
@@ -2197,25 +2197,9 @@
 rch%22
- );%0A    %09    add(
+,
  %22Se
@@ -2232,19 +2232,17 @@
 hecksum%22
- );
+,
 %0A       
@@ -2238,36 +2238,42 @@
 m%22,%0A            
-add(
+          
  %22SearchService.
@@ -2292,36 +2292,17 @@
 ersions%22
- );%0A            add(
+,
  %22Search
@@ -2335,19 +2335,17 @@
 sByDate%22
- );
+,
 %0A       
@@ -2341,36 +2341,42 @@
 e%22,%0A            
-add(
+          
  %22SearchService.
@@ -2391,36 +2391,17 @@
 dencies%22
- );%0A            add(
+,
  %22Search
@@ -2426,19 +2426,17 @@
 ncyTree%22
- );
+,
 %0A       
@@ -2444,12 +2444,18 @@
     
-add(
+          
  %22Se
@@ -2486,470 +2486,8 @@
 %22 );
-%0A    %09 %7D%0A    %7D;%0A%0A    public static final List%3CString%3E SERVICE_METHODS_FOR_OPERATION_ADD_REPOSITORY = new ArrayList%3CString%3E();%0A%0A    public static final List%3CString%3E SERVICE_METHODS_FOR_OPERATION_DELETE_REPOSITORY = new ArrayList%3CString%3E();%0A%0A    public static final List%3CString%3E SERVICE_METHODS_FOR_OPERATION_EDIT_REPOSITORY = new ArrayList%3CString%3E();%0A%0A    public static final List%3CString%3E SERVICE_METHODS_FOR_OPERATION_REPOSITORY_UPLOAD = new ArrayList%3CString%3E();
 %0A%0A%7D%0A

clean up unused methods, bolierplate