]> source.dussan.org Git - archiva.git/blob
94337c088b838526d08b9826ed2a3f91c6bbc04a
[archiva.git] /
1 package org.apache.archiva.web.action.admin.repositories;
2
3 /*
4  * Licensed to the Apache Software Foundation (ASF) under one
5  * or more contributor license agreements.  See the NOTICE file
6  * distributed with this work for additional information
7  * regarding copyright ownership.  The ASF licenses this file
8  * to you under the Apache License, Version 2.0 (the
9  * "License"); you may not use this file except in compliance
10  * with the License.  You may obtain a copy of the License at
11  *
12  *  http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing,
15  * software distributed under the License is distributed on an
16  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17  * KIND, either express or implied.  See the License for the
18  * specific language governing permissions and limitations
19  * under the License.
20  */
21
22 import org.apache.archiva.admin.model.RepositoryCommonValidator;
23 import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin;
24 import org.apache.archiva.audit.Auditable;
25 import org.apache.archiva.security.common.ArchivaRoleConstants;
26 import org.apache.archiva.web.action.AbstractActionSupport;
27 import org.apache.archiva.redback.rbac.Resource;
28 import org.apache.archiva.redback.integration.interceptor.SecureAction;
29 import org.apache.archiva.redback.integration.interceptor.SecureActionBundle;
30 import org.apache.archiva.redback.integration.interceptor.SecureActionException;
31
32 import javax.inject.Inject;
33
34 /**
35  * Abstract AdminRepositories Action base.
36  * <p/>
37  * Base class for all repository administrative functions.
38  * This should be neutral to the type of action (add/edit/delete) and type of repo (managed/remote)
39  *
40  * @version $Id$
41  */
42 public abstract class AbstractRepositoriesAdminAction
43     extends AbstractActionSupport
44     implements SecureAction, Auditable
45 {
46
47     @Inject
48     private ManagedRepositoryAdmin managedRepositoryAdmin;
49
50     @Inject
51     private RepositoryCommonValidator repositoryCommonValidator;
52
53
54     public SecureActionBundle getSecureActionBundle()
55         throws SecureActionException
56     {
57         SecureActionBundle bundle = new SecureActionBundle();
58
59         bundle.setRequiresAuthentication( true );
60         bundle.addRequiredAuthorization( ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION, Resource.GLOBAL );
61
62         return bundle;
63     }
64
65
66
67     public ManagedRepositoryAdmin getManagedRepositoryAdmin()
68     {
69         return managedRepositoryAdmin;
70     }
71
72     public void setManagedRepositoryAdmin( ManagedRepositoryAdmin managedRepositoryAdmin )
73     {
74         this.managedRepositoryAdmin = managedRepositoryAdmin;
75     }
76
77     public RepositoryCommonValidator getRepositoryCommonValidator()
78     {
79         return repositoryCommonValidator;
80     }
81
82     public void setRepositoryCommonValidator( RepositoryCommonValidator repositoryCommonValidator )
83     {
84         this.repositoryCommonValidator = repositoryCommonValidator;
85     }
86 }