You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ranger.apache.org by ma...@apache.org on 2024/11/05 16:52:01 UTC
(ranger) branch ranger-2.6 updated (2004fe096 -> 5f5887bf8)
This is an automated email from the ASF dual-hosted git repository.
madhan pushed a change to branch ranger-2.6
in repository https://gitbox.apache.org/repos/asf/ranger.git
from 2004fe096 RANGER-4833 : Upgrade from Bootbox.js to Bootprompt.js
new c4508e502 RANGER-4972 : Ranger User Type federated user should not log into Ranger for doing any operation
new 5f5887bf8 RANGER-4973 : Enhance Ranger UI to support a new user type for external users from Data Sharing
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../java/org/apache/ranger/biz/SessionMgr.java | 4 +--
.../apache/ranger/common/RangerCommonEnums.java | 9 +++---
.../authentication/RangerAuthSuccessHandler.java | 2 +-
security-admin/src/main/webapp/login.jsp | 2 +-
.../main/webapp/react-webapp/src/utils/XAEnums.js | 11 +++++---
.../users_details/EditUserView.jsx | 3 +-
.../users_details/UserFormComp.jsx | 33 ++++++++++------------
.../users_details/UserListing.jsx | 27 ++++++------------
8 files changed, 41 insertions(+), 50 deletions(-)
(ranger) 02/02: RANGER-4973 : Enhance Ranger UI to support a new user type for external users from Data Sharing
Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
madhan pushed a commit to branch ranger-2.6
in repository https://gitbox.apache.org/repos/asf/ranger.git
commit 5f5887bf897ba6d21157289b5faf13a419bb5a25
Author: Dhaval.Rajpara <dh...@gmail.com>
AuthorDate: Fri Nov 1 20:43:11 2024 +0530
RANGER-4973 : Enhance Ranger UI to support a new user type for external users from Data Sharing
Signed-off-by: Dhaval.Rajpara <dh...@gmail.com>
(cherry picked from commit c2765370d58b002052e6ced823859b4000f945fb)
---
.../main/webapp/react-webapp/src/utils/XAEnums.js | 11 +++++---
.../users_details/EditUserView.jsx | 3 +-
.../users_details/UserFormComp.jsx | 33 ++++++++++------------
.../users_details/UserListing.jsx | 27 ++++++------------
4 files changed, 32 insertions(+), 42 deletions(-)
diff --git a/security-admin/src/main/webapp/react-webapp/src/utils/XAEnums.js b/security-admin/src/main/webapp/react-webapp/src/utils/XAEnums.js
index cd85f3b06..7b75c7669 100644
--- a/security-admin/src/main/webapp/react-webapp/src/utils/XAEnums.js
+++ b/security-admin/src/main/webapp/react-webapp/src/utils/XAEnums.js
@@ -61,14 +61,17 @@ export const UserTypes = {
USER_INTERNAL: {
value: 0,
label: "Internal",
- rbkey: "xa.enum.AccessResult.ACCESS_RESULT_ALLOWED",
- tt: "lbl.AccessResult_ACCESS_RESULT_ALLOWED"
+ variant: "success"
},
USER_EXTERNAL: {
value: 1,
label: "External",
- rbkey: "xa.enum.AccessResult.ACCESS_RESULT_DENIED",
- tt: "lbl.AccessResult_ACCESS_RESULT_DENIED"
+ variant: "warning"
+ },
+ USER_FEDERATED: {
+ value: 2,
+ label: "Federated",
+ variant: "secondary"
}
};
diff --git a/security-admin/src/main/webapp/react-webapp/src/views/UserGroupRoleListing/users_details/EditUserView.jsx b/security-admin/src/main/webapp/react-webapp/src/views/UserGroupRoleListing/users_details/EditUserView.jsx
index e08917bf2..7d04c71ce 100644
--- a/security-admin/src/main/webapp/react-webapp/src/views/UserGroupRoleListing/users_details/EditUserView.jsx
+++ b/security-admin/src/main/webapp/react-webapp/src/views/UserGroupRoleListing/users_details/EditUserView.jsx
@@ -133,7 +133,8 @@ function AddUserView() {
return loader ? (
<Loader />
- ) : userInfo.userSource == UserTypes.USER_EXTERNAL.value ? (
+ ) : userInfo.userSource == UserTypes.USER_EXTERNAL.value ||
+ userInfo.userSource == UserTypes.USER_FEDERATED.value ? (
<>
<div className="header-wraper">
<h3 className="wrap-header bold">User Detail</h3>
diff --git a/security-admin/src/main/webapp/react-webapp/src/views/UserGroupRoleListing/users_details/UserFormComp.jsx b/security-admin/src/main/webapp/react-webapp/src/views/UserGroupRoleListing/users_details/UserFormComp.jsx
index d57d6571c..9f5d642f2 100644
--- a/security-admin/src/main/webapp/react-webapp/src/views/UserGroupRoleListing/users_details/UserFormComp.jsx
+++ b/security-admin/src/main/webapp/react-webapp/src/views/UserGroupRoleListing/users_details/UserFormComp.jsx
@@ -28,7 +28,7 @@ import {
ActivationStatus,
RegexValidation,
UserRoles,
- UserSource
+ UserTypes
} from "Utils/XAEnums";
import { toast } from "react-toastify";
import { getUserAccessRoleList, serverError } from "Utils/XAUtils";
@@ -71,6 +71,9 @@ function UserFormComp(props) {
const { isEditView, userInfo } = props;
const [preventUnBlock, setPreventUnblock] = useState(false);
const toastId = React.useRef(null);
+ const isExternalOrFederatedUser =
+ userInfo?.userSource == UserTypes.USER_EXTERNAL.value ||
+ userInfo?.userSource == UserTypes.USER_FEDERATED.value;
const handleSubmit = async (formData) => {
let userFormData = {};
@@ -215,11 +218,7 @@ function UserFormComp(props) {
defaultOptions
isMulti
isDisabled={
- isEditView &&
- userInfo &&
- userInfo.userSource == UserSource.XA_USER.value
- ? true
- : false
+ isEditView && userInfo && isExternalOrFederatedUser ? true : false
}
/>
);
@@ -229,9 +228,12 @@ function UserFormComp(props) {
const userProps = getUserProfile();
let disabledUserRolefield;
if (isEditView && userInfo) {
- if (userInfo.userSource == UserSource.XA_USER.value) {
+ if (userInfo.userSource == UserTypes.USER_EXTERNAL.value) {
disabledUserRolefield = true;
}
+ if (userInfo.userSource == UserTypes.USER_FEDERATED.value) {
+ return (disabledUserRolefield = true);
+ }
if (userProps.loginId != "admin") {
if (userInfo.name != "admin") {
if (
@@ -297,7 +299,7 @@ function UserFormComp(props) {
if (
isEditView &&
userInfo &&
- userInfo.userSource == UserSource.XA_USER.value &&
+ userInfo.userSource == UserTypes.USER_EXTERNAL.value &&
e.label != input.value.label
) {
toast.dismiss(toastId.current);
@@ -328,7 +330,8 @@ function UserFormComp(props) {
if (isEditView) {
if (
!values.firstName &&
- userInfo.userSource !== UserSource.XA_USER.value
+ userInfo.userSource !== UserTypes.USER_EXTERNAL.value &&
+ userInfo.userSource !== UserTypes.USER_FEDERATED.value
) {
errors.firstName = "Required";
}
@@ -568,9 +571,7 @@ function UserFormComp(props) {
: "form-control"
}
disabled={
- isEditView &&
- userInfo &&
- userInfo.userSource == UserSource.XA_USER.value
+ isEditView && userInfo && isExternalOrFederatedUser
? true
: false
}
@@ -607,9 +608,7 @@ function UserFormComp(props) {
: "form-control"
}
disabled={
- isEditView &&
- userInfo &&
- userInfo.userSource == UserSource.XA_USER.value
+ isEditView && userInfo && isExternalOrFederatedUser
? true
: false
}
@@ -652,9 +651,7 @@ function UserFormComp(props) {
: "form-control"
}
disabled={
- isEditView &&
- userInfo &&
- userInfo.userSource == UserSource.XA_USER.value
+ isEditView && userInfo && isExternalOrFederatedUser
? true
: false
}
diff --git a/security-admin/src/main/webapp/react-webapp/src/views/UserGroupRoleListing/users_details/UserListing.jsx b/security-admin/src/main/webapp/react-webapp/src/views/UserGroupRoleListing/users_details/UserListing.jsx
index 38b9abc40..8c2932598 100644
--- a/security-admin/src/main/webapp/react-webapp/src/views/UserGroupRoleListing/users_details/UserListing.jsx
+++ b/security-admin/src/main/webapp/react-webapp/src/views/UserGroupRoleListing/users_details/UserListing.jsx
@@ -29,12 +29,7 @@ import {
} from "react-bootstrap";
import moment from "moment-timezone";
import XATableLayout from "Components/XATableLayout";
-import {
- UserRoles,
- UserSource,
- UserTypes,
- VisibilityStatus
-} from "Utils/XAEnums";
+import { UserRoles, UserTypes, VisibilityStatus } from "Utils/XAEnums";
import { MoreLess, scrollToNewData } from "Components/CommonComponents";
import {
useNavigate,
@@ -371,19 +366,13 @@ function Users() {
Header: "User Source",
accessor: "userSource",
Cell: (rawValue) => {
- if (rawValue.value !== null && rawValue.value !== undefined) {
- if (rawValue.value == UserSource.XA_PORTAL_USER.value)
- return (
- <h6 className="text-center">
- <Badge bg="success">{UserTypes.USER_INTERNAL.label}</Badge>
- </h6>
- );
- else
- return (
- <h6 className="text-center">
- <Badge bg="warning">{UserTypes.USER_EXTERNAL.label}</Badge>
- </h6>
- );
+ if (rawValue?.value != null) {
+ const userSourceVal = find(UserTypes, { value: rawValue.value });
+ return (
+ <h6 className="text-center">
+ <Badge bg={userSourceVal.variant}>{userSourceVal.label}</Badge>
+ </h6>
+ );
} else return "--";
},
width: 70
(ranger) 01/02: RANGER-4972 : Ranger User Type federated user should not log into Ranger for doing any operation
Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
madhan pushed a commit to branch ranger-2.6
in repository https://gitbox.apache.org/repos/asf/ranger.git
commit c4508e502ad3d0aac818983cd40e98fd6b2be990
Author: Dineshkumar Yadav <di...@outlook.com>
AuthorDate: Tue Oct 29 22:49:31 2024 +0530
RANGER-4972 : Ranger User Type federated user should not log into Ranger for doing any operation
Signed-off-by: Dineshkumar Yadav <di...@outlook.com>
(cherry picked from commit 2b2da8d79f01aa2f9ed514aa59a7ae7ae3d4d222)
---
.../src/main/java/org/apache/ranger/biz/SessionMgr.java | 4 ++--
.../main/java/org/apache/ranger/common/RangerCommonEnums.java | 9 +++++----
.../security/web/authentication/RangerAuthSuccessHandler.java | 2 +-
security-admin/src/main/webapp/login.jsp | 2 +-
4 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/security-admin/src/main/java/org/apache/ranger/biz/SessionMgr.java b/security-admin/src/main/java/org/apache/ranger/biz/SessionMgr.java
index 55e77bc64..bca2e2ea6 100644
--- a/security-admin/src/main/java/org/apache/ranger/biz/SessionMgr.java
+++ b/security-admin/src/main/java/org/apache/ranger/biz/SessionMgr.java
@@ -482,8 +482,8 @@ public class SessionMgr {
public boolean isValidXAUser(String loginId) {
XXPortalUser pUser = daoManager.getXXPortalUser().findByLoginId(loginId);
- if (pUser == null) {
- logger.error("Error getting user for loginId=" + loginId);
+ if (pUser == null || pUser.getUserSource() == RangerCommonEnums.USER_FEDERATED) {
+ logger.error("Error getting user for loginId=" + loginId + " or federated user");
return false;
} else {
if(logger.isDebugEnabled()) {
diff --git a/security-admin/src/main/java/org/apache/ranger/common/RangerCommonEnums.java b/security-admin/src/main/java/org/apache/ranger/common/RangerCommonEnums.java
index 5d0a665a2..ad40b3077 100644
--- a/security-admin/src/main/java/org/apache/ranger/common/RangerCommonEnums.java
+++ b/security-admin/src/main/java/org/apache/ranger/common/RangerCommonEnums.java
@@ -480,10 +480,11 @@ public class RangerCommonEnums {
*/
public static final int USER_APP = 0;
public static final int USER_EXTERNAL = 1;
- public static final int USER_AD= 2;
- public static final int USER_LDAP = 3;
- public static final int USER_UNIX = 4;
- public static final int USER_REPO = 5;
+ public static final int USER_FEDERATED= 2;
+ public static final int USER_AD= 3;
+ public static final int USER_LDAP = 4;
+ public static final int USER_UNIX = 5;
+ public static final int USER_REPO = 6;
public static final int GROUP_INTERNAL = 0;
public static final int GROUP_EXTERNAL = 1;
diff --git a/security-admin/src/main/java/org/apache/ranger/security/web/authentication/RangerAuthSuccessHandler.java b/security-admin/src/main/java/org/apache/ranger/security/web/authentication/RangerAuthSuccessHandler.java
index eb754f388..890c33422 100644
--- a/security-admin/src/main/java/org/apache/ranger/security/web/authentication/RangerAuthSuccessHandler.java
+++ b/security-admin/src/main/java/org/apache/ranger/security/web/authentication/RangerAuthSuccessHandler.java
@@ -110,7 +110,7 @@ SavedRequestAwareAuthenticationSuccessHandler {
authentication.setAuthenticated(false);
vXResponse.setStatusCode(HttpServletResponse.SC_PRECONDITION_FAILED);
- vXResponse.setMsgDesc("Auth Succeeded but user is not synced yet for " + authentication.getName());
+ vXResponse.setMsgDesc("Auth Succeeded but user is not synced yet or federated-user for " + authentication.getName());
response.setStatus(HttpServletResponse.SC_PRECONDITION_FAILED);
response.getWriter().write(jsonUtil.writeObjectAsString(vXResponse));
diff --git a/security-admin/src/main/webapp/login.jsp b/security-admin/src/main/webapp/login.jsp
index ce7bd80fe..1de9a978c 100644
--- a/security-admin/src/main/webapp/login.jsp
+++ b/security-admin/src/main/webapp/login.jsp
@@ -82,7 +82,7 @@
<span id="errorBox" class="help-inline" style="color:white;display:none;"><span class="errorMsg"></span>
<i class="fa fa-exclamation-triangle" style="color:#ae2817;"></i>
</span>
- <span id="errorBoxUnsynced" class="help-inline" style="color:white;display:none;">User is not available in HDP Admin Tool. Please contact your Administrator.
+ <span id="errorBoxUnsynced" class="help-inline" style="color:white;display:none;">User is not available in Ranger Admin Tool. Please contact your Administrator.
<i class="fa fa-exclamation-triangle" style="color:#ae2817;"></i>
</span>
<button type="submit" class="btn btn-primary btn-block" id="signIn" tabindex="4" >