Search in sources :

Example 36 with SearchCriteria

use of org.apache.ranger.common.SearchCriteria in project ranger by apache.

the class XUserREST method searchXUserPermission.

@GET
@Path("/permission/user")
@Produces({ "application/xml", "application/json" })
@PreAuthorize("@rangerPreAuthSecurityHandler.isAPIAccessible(\"" + RangerAPIList.SEARCH_X_USER_PERMISSION + "\")")
public VXUserPermissionList searchXUserPermission(@Context HttpServletRequest request) {
    SearchCriteria searchCriteria = searchUtil.extractCommonCriterias(request, xUserPermissionService.sortFields);
    searchUtil.extractString(request, searchCriteria, "id", "id", StringUtil.VALIDATION_NAME);
    searchUtil.extractString(request, searchCriteria, "userPermissionList", "userId", StringUtil.VALIDATION_NAME);
    return xUserMgr.searchXUserPermission(searchCriteria);
}
Also used : SearchCriteria(org.apache.ranger.common.SearchCriteria) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET) PreAuthorize(org.springframework.security.access.prepost.PreAuthorize)

Example 37 with SearchCriteria

use of org.apache.ranger.common.SearchCriteria in project ranger by apache.

the class XUserREST method searchXModuleDef.

@GET
@Path("/permission")
@Produces({ "application/xml", "application/json" })
@PreAuthorize("@rangerPreAuthSecurityHandler.isAPIAccessible(\"" + RangerAPIList.SEARCH_X_MODULE_DEF + "\")")
public VXModuleDefList searchXModuleDef(@Context HttpServletRequest request) {
    SearchCriteria searchCriteria = searchUtil.extractCommonCriterias(request, xModuleDefService.sortFields);
    searchUtil.extractString(request, searchCriteria, "module", "modulename", null);
    searchUtil.extractString(request, searchCriteria, "moduleDefList", "id", null);
    searchUtil.extractString(request, searchCriteria, "userName", "userName", null);
    searchUtil.extractString(request, searchCriteria, "groupName", "groupName", null);
    return xUserMgr.searchXModuleDef(searchCriteria);
}
Also used : SearchCriteria(org.apache.ranger.common.SearchCriteria) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET) PreAuthorize(org.springframework.security.access.prepost.PreAuthorize)

Example 38 with SearchCriteria

use of org.apache.ranger.common.SearchCriteria in project ranger by apache.

the class XUserREST method searchXGroupPermission.

@GET
@Path("/permission/group")
@Produces({ "application/xml", "application/json" })
@PreAuthorize("@rangerPreAuthSecurityHandler.isAPIAccessible(\"" + RangerAPIList.SEARCH_X_GROUP_PERMISSION + "\")")
public VXGroupPermissionList searchXGroupPermission(@Context HttpServletRequest request) {
    SearchCriteria searchCriteria = searchUtil.extractCommonCriterias(request, xGroupPermissionService.sortFields);
    searchUtil.extractString(request, searchCriteria, "id", "id", StringUtil.VALIDATION_NAME);
    searchUtil.extractString(request, searchCriteria, "groupPermissionList", "groupId", StringUtil.VALIDATION_NAME);
    return xUserMgr.searchXGroupPermission(searchCriteria);
}
Also used : SearchCriteria(org.apache.ranger.common.SearchCriteria) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET) PreAuthorize(org.springframework.security.access.prepost.PreAuthorize)

Example 39 with SearchCriteria

use of org.apache.ranger.common.SearchCriteria in project ranger by apache.

the class XUserREST method getAuthSessions.

@GET
@Path("/authSessions")
@Produces({ "application/xml", "application/json" })
@PreAuthorize("@rangerPreAuthSecurityHandler.isAPIAccessible(\"" + RangerAPIList.GET_AUTH_SESSIONS + "\")")
public VXAuthSessionList getAuthSessions(@Context HttpServletRequest request) {
    SearchCriteria searchCriteria = searchUtil.extractCommonCriterias(request, AuthSessionService.AUTH_SESSION_SORT_FLDS);
    searchUtil.extractLong(request, searchCriteria, "id", "Auth Session Id");
    searchUtil.extractLong(request, searchCriteria, "userId", "User Id");
    searchUtil.extractInt(request, searchCriteria, "authStatus", "Auth Status");
    searchUtil.extractInt(request, searchCriteria, "authType", "Login Type");
    searchUtil.extractInt(request, searchCriteria, "deviceType", "Device Type");
    searchUtil.extractString(request, searchCriteria, "firstName", "User First Name", StringUtil.VALIDATION_NAME);
    searchUtil.extractString(request, searchCriteria, "lastName", "User Last Name", StringUtil.VALIDATION_NAME);
    searchUtil.extractString(request, searchCriteria, "requestUserAgent", "User Agent", StringUtil.VALIDATION_TEXT);
    searchUtil.extractString(request, searchCriteria, "requestIP", "Request IP Address", StringUtil.VALIDATION_IP_ADDRESS);
    searchUtil.extractString(request, searchCriteria, "loginId", "Login ID", StringUtil.VALIDATION_TEXT);
    searchUtil.extractDate(request, searchCriteria, "startDate", "Start Date", null);
    searchUtil.extractDate(request, searchCriteria, "endDate", "End Date", null);
    return sessionMgr.searchAuthSessions(searchCriteria);
}
Also used : SearchCriteria(org.apache.ranger.common.SearchCriteria) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET) PreAuthorize(org.springframework.security.access.prepost.PreAuthorize)

Example 40 with SearchCriteria

use of org.apache.ranger.common.SearchCriteria in project ranger by apache.

the class XUserREST method searchXGroups.

/**
 * Implements the traditional search functionalities for XGroups
 *
 * @param request
 * @return
 */
@GET
@Path("/groups")
@Produces({ "application/xml", "application/json" })
@PreAuthorize("@rangerPreAuthSecurityHandler.isAPIAccessible(\"" + RangerAPIList.SEARCH_X_GROUPS + "\")")
public VXGroupList searchXGroups(@Context HttpServletRequest request) {
    SearchCriteria searchCriteria = searchUtil.extractCommonCriterias(request, xGroupService.sortFields);
    searchUtil.extractString(request, searchCriteria, "name", "group name", null);
    searchUtil.extractInt(request, searchCriteria, "isVisible", "Group Visibility");
    searchUtil.extractString(request, searchCriteria, "groupSource", "group source", null);
    // searchUtil.extractInt(request, searchCriteria, "groupSource", "group source");
    return xUserMgr.searchXGroups(searchCriteria);
}
Also used : SearchCriteria(org.apache.ranger.common.SearchCriteria) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET) PreAuthorize(org.springframework.security.access.prepost.PreAuthorize)

Aggregations

SearchCriteria (org.apache.ranger.common.SearchCriteria)61 Test (org.junit.Test)29 SortField (org.apache.ranger.common.SortField)27 ArrayList (java.util.ArrayList)22 HttpServletRequest (javax.servlet.http.HttpServletRequest)20 GET (javax.ws.rs.GET)13 Path (javax.ws.rs.Path)12 Produces (javax.ws.rs.Produces)12 PreAuthorize (org.springframework.security.access.prepost.PreAuthorize)12 VXLong (org.apache.ranger.view.VXLong)10 Date (java.util.Date)9 DateUtil (org.apache.ranger.common.DateUtil)6 HashMap (java.util.HashMap)4 XXPortalUser (org.apache.ranger.entity.XXPortalUser)4 RangerPolicy (org.apache.ranger.plugin.model.RangerPolicy)4 RangerPolicyItem (org.apache.ranger.plugin.model.RangerPolicy.RangerPolicyItem)4 VXPermMap (org.apache.ranger.view.VXPermMap)4 VXUserList (org.apache.ranger.view.VXUserList)4 List (java.util.List)3 XXServiceDef (org.apache.ranger.entity.XXServiceDef)3