1 /*******************************************************************************
\r
2 * ============LICENSE_START====================================================
\r
4 * * ===========================================================================
\r
5 * * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
\r
6 * * ===========================================================================
\r
7 * * Licensed under the Apache License, Version 2.0 (the "License");
\r
8 * * you may not use this file except in compliance with the License.
\r
9 * * You may obtain a copy of the License at
\r
11 * * http://www.apache.org/licenses/LICENSE-2.0
\r
13 * * Unless required by applicable law or agreed to in writing, software
\r
14 * * distributed under the License is distributed on an "AS IS" BASIS,
\r
15 * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
16 * * See the License for the specific language governing permissions and
\r
17 * * limitations under the License.
\r
18 * * ============LICENSE_END====================================================
\r
20 * * ECOMP is a trademark and service mark of AT&T Intellectual Property.
\r
22 ******************************************************************************/
\r
23 package com.att.authz.service;
\r
25 import java.util.Date;
\r
27 import javax.servlet.http.HttpServletRequest;
\r
29 import com.att.authz.env.AuthzTrans;
\r
30 import com.att.authz.layer.Result;
\r
31 import com.att.authz.service.mapper.Mapper;
\r
32 import com.att.dao.DAOException;
\r
33 import com.att.dao.aaf.cass.NsType;
\r
35 public interface AuthzService<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DELGS,CERTS,KEYS,REQUEST,HISTORY,ERR,APPROVALS> {
\r
36 public Mapper<NSS,PERMS,PERMKEY,ROLES,USERS,USERROLES,DELGS,CERTS,KEYS,REQUEST,HISTORY,ERR,APPROVALS> mapper();
\r
38 /***********************************
\r
40 ***********************************/
\r
47 * @throws DAOException
\r
50 public Result<Void> createNS(AuthzTrans trans, REQUEST request, NsType type);
\r
58 public Result<Void> addAdminNS(AuthzTrans trans, String ns, String id);
\r
66 public Result<Void> delAdminNS(AuthzTrans trans, String ns, String id);
\r
75 public Result<Void> addResponsibleNS(AuthzTrans trans, String ns, String id);
\r
84 public Result<Void> delResponsibleNS(AuthzTrans trans, String ns, String id);
\r
94 public Result<Void> createNsAttrib(AuthzTrans trans, String ns, String key, String value);
\r
104 public Result<?> updateNsAttrib(AuthzTrans trans, String ns, String key, String value);
\r
113 public Result<Void> deleteNsAttrib(AuthzTrans trans, String ns, String key);
\r
122 public Result<KEYS> readNsByAttrib(AuthzTrans trans, String key);
\r
131 public Result<NSS> getNSbyName(AuthzTrans trans, String ns);
\r
139 public Result<NSS> getNSbyAdmin(AuthzTrans trans, String user, boolean full);
\r
147 public Result<NSS> getNSbyResponsible(AuthzTrans trans, String user, boolean full);
\r
155 public Result<NSS> getNSbyEither(AuthzTrans trans, String user, boolean full);
\r
163 public Result<NSS> getNSsChildren(AuthzTrans trans, String parent);
\r
171 public Result<Void> updateNsDescription(AuthzTrans trans, REQUEST req);
\r
179 * @throws DAOException
\r
181 public Result<Void> deleteNS(AuthzTrans trans, String ns);
\r
183 /***********************************
\r
185 ***********************************/
\r
191 * @throws DAOException
\r
192 * @throws MappingException
\r
194 public Result<Void> createPerm(AuthzTrans trans, REQUEST rreq);
\r
201 * @throws DAOException
\r
203 public Result<PERMS> getPermsByType(AuthzTrans trans, String perm);
\r
213 public Result<PERMS> getPermsByName(AuthzTrans trans, String type,
\r
214 String instance, String action);
\r
217 * Gets all the permissions for a user across all the roles it is assigned to
\r
220 * @throws Exception
\r
221 * @throws Exception
\r
223 public Result<PERMS> getPermsByUser(AuthzTrans trans, String userName);
\r
226 * Gets all the permissions for a user across all the roles it is assigned to
\r
228 * Add AAF Perms representing the "MayUser" calls if
\r
230 * 2) User has equivalent permission
\r
234 * @throws Exception
\r
235 * @throws Exception
\r
237 public Result<PERMS> getPermsByUser(AuthzTrans trans, PERMS perms, String userName);
\r
241 * Gets all the permissions for a user across all the roles it is assigned to
\r
245 * @throws Exception
\r
247 public Result<PERMS> getPermsByRole(AuthzTrans trans, String roleName);
\r
255 public Result<PERMS> getPermsByNS(AuthzTrans trans, String ns);
\r
258 * rename permission
\r
264 * @param origInstance
\r
265 * @param origAction
\r
268 public Result<Void> renamePerm(AuthzTrans trans, REQUEST rreq, String origType, String origInstance, String origAction);
\r
276 public Result<Void> updatePermDescription(AuthzTrans trans, REQUEST req);
\r
284 public Result<Void> resetPermRoles(AuthzTrans trans, REQUEST from);
\r
291 * @throws Exception
\r
293 public Result<Void> deletePerm(AuthzTrans trans, REQUEST from);
\r
303 * @throws Exception
\r
305 Result<Void> deletePerm(AuthzTrans trans, String perm, String type, String action);
\r
307 /***********************************
\r
309 ***********************************/
\r
317 * @throws DAOException
\r
318 * @throws Exception
\r
320 public Result<Void> createRole(AuthzTrans trans, REQUEST req);
\r
328 public Result<ROLES> getRolesByName(AuthzTrans trans, String role);
\r
335 * @throws DAOException
\r
337 public Result<ROLES> getRolesByUser(AuthzTrans trans, String user);
\r
345 public Result<ROLES> getRolesByNS(AuthzTrans trans, String user);
\r
353 public Result<ROLES> getRolesByNameOnly(AuthzTrans trans, String name);
\r
363 public Result<ROLES> getRolesByPerm(AuthzTrans trans, String type, String instance, String action);
\r
371 public Result<Void> updateRoleDescription(AuthzTrans trans, REQUEST req);
\r
378 * @throws DAOException
\r
380 public Result<Void> addPermToRole(AuthzTrans trans, REQUEST rreq);
\r
388 * @throws DAOException
\r
390 Result<Void> delPermFromRole(AuthzTrans trans, REQUEST rreq);
\r
399 * @throws DAOException
\r
400 * @throws MappingException
\r
402 public Result<Void> deleteRole(AuthzTrans trans, String role);
\r
410 public Result<Void> deleteRole(AuthzTrans trans, REQUEST req);
\r
412 /***********************************
\r
414 ***********************************/
\r
422 Result<Void> createUserCred(AuthzTrans trans, REQUEST from);
\r
430 Result<Void> changeUserCred(AuthzTrans trans, REQUEST from);
\r
439 Result<Void> extendUserCred(AuthzTrans trans, REQUEST from, String days);
\r
447 public Result<USERS> getCredsByNS(AuthzTrans trans, String ns);
\r
455 public Result<USERS> getCredsByID(AuthzTrans trans, String id);
\r
464 public Result<CERTS> getCertInfoByID(AuthzTrans trans, HttpServletRequest req, String id);
\r
472 public Result<Void> deleteUserCred(AuthzTrans trans, REQUEST credReq);
\r
479 * @throws Exception
\r
481 public Result<Date> doesCredentialMatch(AuthzTrans trans, REQUEST credReq);
\r
489 public Result<Date> validateBasicAuth(AuthzTrans trans, String basicAuth);
\r
497 public Result<USERS> getUsersByRole(AuthzTrans trans, String role);
\r
505 public Result<USERS> getUserInRole(AuthzTrans trans, String user, String role);
\r
515 public Result<USERS> getUsersByPermission(AuthzTrans trans,String type, String instance, String action);
\r
520 /***********************************
\r
522 ***********************************/
\r
529 * @throws Exception
\r
531 public Result<Void> createUserRole(AuthzTrans trans, REQUEST request);
\r
539 public Result<USERROLES> getUserRolesByRole(AuthzTrans trans, String role);
\r
547 public Result<USERROLES> getUserRolesByUser(AuthzTrans trans, String user);
\r
555 public Result<Void> resetRolesForUser(AuthzTrans trans, REQUEST from);
\r
563 public Result<Void> resetUsersForRole(AuthzTrans trans, REQUEST from);
\r
572 public Result<Void> extendUserRole(AuthzTrans trans, String user,
\r
582 * @throws DAOException
\r
584 public Result<Void> deleteUserRole(AuthzTrans trans, String usr, String role);
\r
588 /***********************************
\r
590 ***********************************/
\r
598 public Result<HISTORY> getHistoryByUser(AuthzTrans trans, String user, int[] yyyymm, int sort);
\r
608 public Result<HISTORY> getHistoryByRole(AuthzTrans trans, String subj, int[] yyyymm, int sort);
\r
618 public Result<HISTORY> getHistoryByPerm(AuthzTrans trans, String subj, int[] yyyymm, int sort);
\r
628 public Result<HISTORY> getHistoryByNS(AuthzTrans trans, String subj, int[] yyyymm, int sort);
\r
630 /***********************************
\r
632 ***********************************/
\r
638 * @throws Exception
\r
640 public Result<Void> createDelegate(AuthzTrans trans, REQUEST reqDelegate);
\r
647 * @throws Exception
\r
649 public Result<Void> updateDelegate(AuthzTrans trans, REQUEST reqDelegate);
\r
657 * @throws Exception
\r
659 public Result<Void> deleteDelegate(AuthzTrans trans, REQUEST reqDelegate);
\r
667 public Result<Void> deleteDelegate(AuthzTrans trans, String userName);
\r
674 * @throws Exception
\r
676 public Result<DELGS> getDelegatesByUser(AuthzTrans trans, String user);
\r
685 public Result<DELGS> getDelegatesByDelegate(AuthzTrans trans, String delegate);
\r
687 /***********************************
\r
689 ***********************************/
\r
698 public Result<Void> updateApproval(AuthzTrans trans, APPROVALS approvals);
\r
706 public Result<APPROVALS> getApprovalsByUser(AuthzTrans trans, String user);
\r
714 public Result<APPROVALS> getApprovalsByTicket(AuthzTrans trans, String ticket);
\r
722 public Result<APPROVALS> getApprovalsByApprover(AuthzTrans trans, String approver);
\r
730 public Result<Void> cacheClear(AuthzTrans trans, String cname);
\r
739 public Result<Void> cacheClear(AuthzTrans trans, String cname, int[] segment);
\r
745 public void dbReset(AuthzTrans trans);
\r