mirror of
https://github.com/casdoor/casdoor.git
synced 2025-05-23 02:35:49 +08:00
Fix normal user my-account page blank bug
This commit is contained in:
parent
92b6fda0f6
commit
fbdd5a926d
@ -469,14 +469,24 @@ func GetMaskedApplication(application *Application, userId string) *Application
|
|||||||
application.FailedSigninFrozenTime = DefaultFailedSigninFrozenTime
|
application.FailedSigninFrozenTime = DefaultFailedSigninFrozenTime
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isOrgUser := false
|
||||||
if userId != "" {
|
if userId != "" {
|
||||||
if isUserIdGlobalAdmin(userId) {
|
if isUserIdGlobalAdmin(userId) {
|
||||||
return application
|
return application
|
||||||
}
|
}
|
||||||
|
|
||||||
user, _ := GetUser(userId)
|
user, err := GetUser(userId)
|
||||||
if user != nil && user.IsApplicationAdmin(application) {
|
if err != nil {
|
||||||
return application
|
panic(err)
|
||||||
|
}
|
||||||
|
if user != nil {
|
||||||
|
if user.IsApplicationAdmin(application) {
|
||||||
|
return application
|
||||||
|
}
|
||||||
|
|
||||||
|
if user.Owner == application.Organization {
|
||||||
|
isOrgUser = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -519,8 +529,11 @@ func GetMaskedApplication(application *Application, userId string) *Application
|
|||||||
application.OrganizationObj.InitScore = -1
|
application.OrganizationObj.InitScore = -1
|
||||||
application.OrganizationObj.EnableSoftDeletion = false
|
application.OrganizationObj.EnableSoftDeletion = false
|
||||||
application.OrganizationObj.IsProfilePublic = false
|
application.OrganizationObj.IsProfilePublic = false
|
||||||
application.OrganizationObj.MfaItems = nil
|
|
||||||
application.OrganizationObj.AccountItems = nil
|
if !isOrgUser {
|
||||||
|
application.OrganizationObj.MfaItems = nil
|
||||||
|
application.OrganizationObj.AccountItems = nil
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return application
|
return application
|
||||||
|
@ -64,7 +64,9 @@ class UserEditPage extends React.Component {
|
|||||||
|
|
||||||
UNSAFE_componentWillMount() {
|
UNSAFE_componentWillMount() {
|
||||||
this.getUser();
|
this.getUser();
|
||||||
this.getOrganizations();
|
if (Setting.isLocalAdminUser(this.props.account)) {
|
||||||
|
this.getOrganizations();
|
||||||
|
}
|
||||||
this.getApplicationsByOrganization(this.state.organizationName);
|
this.getApplicationsByOrganization(this.state.organizationName);
|
||||||
this.getUserApplication();
|
this.getUserApplication();
|
||||||
this.setReturnUrl();
|
this.setReturnUrl();
|
||||||
@ -1001,7 +1003,7 @@ class UserEditPage extends React.Component {
|
|||||||
<div style={{verticalAlign: "middle", marginBottom: 10}}>{`(${i18next.t("general:empty")})`}</div>
|
<div style={{verticalAlign: "middle", marginBottom: 10}}>{`(${i18next.t("general:empty")})`}</div>
|
||||||
</Col>
|
</Col>
|
||||||
}
|
}
|
||||||
<CropperDivModal disabled={disabled} tag={tag} setTitle={set} buttonText={`${title}...`} title={title} user={this.state.user} organization={this.state.organizations.find(organization => organization.name === this.state.organizationName)} />
|
<CropperDivModal disabled={disabled} tag={tag} setTitle={set} buttonText={`${title}...`} title={title} user={this.state.user} organization={this.getUserOrganization()} />
|
||||||
</Col>
|
</Col>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user