Web: People: Disabled editing of UserType and Group in MyProfile with action=edit

This commit is contained in:
Alexey Safronov 2021-05-13 13:43:45 +03:00
parent 3db2963106
commit d7d22a9369
3 changed files with 22 additions and 19 deletions

View File

@ -6,7 +6,7 @@ import UpdateUserForm from "./updateUserForm";
import { inject, observer } from "mobx-react";
import { withRouter } from "react-router";
const SectionUserBody = ({ avatarEditorIsOpen, match }) => {
const SectionUserBody = ({ avatarEditorIsOpen, match, isMy }) => {
const { type } = match.params;
return type ? (
avatarEditorIsOpen ? (
@ -17,7 +17,7 @@ const SectionUserBody = ({ avatarEditorIsOpen, match }) => {
) : avatarEditorIsOpen ? (
<AvatarEditorPage />
) : (
<UpdateUserForm />
<UpdateUserForm isMy={isMy} />
);
};

View File

@ -548,6 +548,7 @@ class UpdateUserForm extends React.Component {
//avatarMax,
disableProfileType,
isAdmin,
isMy,
} = this.props;
const {
guestCaption,
@ -775,7 +776,7 @@ class UpdateUserForm extends React.Component {
{ value: "true", label: guestCaption },
{ value: "false", label: userCaption },
]}
radioIsDisabled={isLoading || disableProfileType}
radioIsDisabled={isLoading || disableProfileType || isMy}
radioOnChange={this.onUserTypeChange}
tooltipContent={tooltipTypeContent}
helpButtonHeaderContent={t("UserType")}
@ -810,20 +811,22 @@ class UpdateUserForm extends React.Component {
inputOnChange={this.onInputChange}
inputTabIndex={9}
/>
<DepartmentField
labelText={`${groupCaption}:`}
isDisabled={isLoading || !isAdmin}
showGroupSelectorButtonTitle={t("AddButton")}
onShowGroupSelector={this.onShowGroupSelector}
onCloseGroupSelector={this.onCloseGroupSelector}
onRemoveGroup={this.onRemoveGroup}
selectorIsVisible={selector.visible}
selectorOptions={selector.options}
selectorSelectedOptions={selector.selected}
selectorSelectAllText={t("SelectAll")}
selectorOnSearchGroups={this.onSearchGroups}
selectorOnSelectGroups={this.onSelectGroups}
/>
{!isMy && (
<DepartmentField
labelText={`${groupCaption}:`}
isDisabled={isLoading || !isAdmin}
showGroupSelectorButtonTitle={t("AddButton")}
onShowGroupSelector={this.onShowGroupSelector}
onCloseGroupSelector={this.onCloseGroupSelector}
onRemoveGroup={this.onRemoveGroup}
selectorIsVisible={selector.visible}
selectorOptions={selector.options}
selectorSelectedOptions={selector.selected}
selectorSelectAllText={t("SelectAll")}
selectorOnSearchGroups={this.onSearchGroups}
selectorOnSelectGroups={this.onSelectGroups}
/>
)}
</MainFieldsContainer>
</MainContainer>
<InfoFieldContainer headerText={t("Comments")}>

View File

@ -71,7 +71,7 @@ class ProfileAction extends React.Component {
console.log("ProfileAction render");
this.loaded = false;
const { profile, match } = this.props;
const { profile, match, isMy } = this.props;
const { userId, type } = match.params;
if (type) {
@ -100,7 +100,7 @@ class ProfileAction extends React.Component {
<PageLayout.SectionBody>
{this.loaded ? (
<SectionUserBody />
<SectionUserBody isMy={isMy} />
) : (
<Loaders.ProfileView isEdit={false} />
)}