mirror of
https://github.com/casdoor/casdoor.git
synced 2025-05-23 10:45:47 +08:00
Show tag in i18n
This commit is contained in:
parent
770ae47471
commit
295f732b18
@ -142,7 +142,7 @@ func IsAllowed(subOwner string, subName string, method string, urlPath string, o
|
|||||||
|
|
||||||
userId := fmt.Sprintf("%s/%s", subOwner, subName)
|
userId := fmt.Sprintf("%s/%s", subOwner, subName)
|
||||||
user := object.GetUser(userId)
|
user := object.GetUser(userId)
|
||||||
if user != nil && user.IsAdmin && subOwner == objOwner {
|
if user != nil && user.IsAdmin && (subOwner == objOwner || (objOwner == "admin" && subOwner == objName)) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,6 +17,7 @@ import {Link} from "react-router-dom";
|
|||||||
import {Button, Popconfirm, Switch, Table, Upload} from "antd";
|
import {Button, Popconfirm, Switch, Table, Upload} from "antd";
|
||||||
import {UploadOutlined} from "@ant-design/icons";
|
import {UploadOutlined} from "@ant-design/icons";
|
||||||
import moment from "moment";
|
import moment from "moment";
|
||||||
|
import * as OrganizationBackend from "./backend/OrganizationBackend";
|
||||||
import * as Setting from "./Setting";
|
import * as Setting from "./Setting";
|
||||||
import * as UserBackend from "./backend/UserBackend";
|
import * as UserBackend from "./backend/UserBackend";
|
||||||
import i18next from "i18next";
|
import i18next from "i18next";
|
||||||
@ -28,6 +29,7 @@ class UserListPage extends BaseListPage {
|
|||||||
this.state = {
|
this.state = {
|
||||||
classes: props,
|
classes: props,
|
||||||
organizationName: props.match.params.organizationName,
|
organizationName: props.match.params.organizationName,
|
||||||
|
organization: null,
|
||||||
data: [],
|
data: [],
|
||||||
pagination: {
|
pagination: {
|
||||||
current: 1,
|
current: 1,
|
||||||
@ -271,6 +273,15 @@ class UserListPage extends BaseListPage {
|
|||||||
width: "110px",
|
width: "110px",
|
||||||
sorter: true,
|
sorter: true,
|
||||||
...this.getColumnSearchProps("tag"),
|
...this.getColumnSearchProps("tag"),
|
||||||
|
render: (text, record, index) => {
|
||||||
|
const tagMap = {};
|
||||||
|
this.state.organization?.tags?.map((tag, index) => {
|
||||||
|
const tokens = tag.split("|");
|
||||||
|
const displayValue = Setting.getLanguage() !== "zh" ? tokens[0] : tokens[1];
|
||||||
|
tagMap[tokens[0]] = displayValue;
|
||||||
|
});
|
||||||
|
return tagMap[text];
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: i18next.t("user:Is admin"),
|
title: i18next.t("user:Is admin"),
|
||||||
@ -387,6 +398,11 @@ class UserListPage extends BaseListPage {
|
|||||||
searchText: params.searchText,
|
searchText: params.searchText,
|
||||||
searchedColumn: params.searchedColumn,
|
searchedColumn: params.searchedColumn,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const users = res.data;
|
||||||
|
if (users.length > 0) {
|
||||||
|
this.getOrganization(users[0].owner);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
@ -403,10 +419,24 @@ class UserListPage extends BaseListPage {
|
|||||||
searchText: params.searchText,
|
searchText: params.searchText,
|
||||||
searchedColumn: params.searchedColumn,
|
searchedColumn: params.searchedColumn,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const users = res.data;
|
||||||
|
if (users.length > 0) {
|
||||||
|
this.getOrganization(users[0].owner);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
getOrganization(organizationName) {
|
||||||
|
OrganizationBackend.getOrganization("admin", organizationName)
|
||||||
|
.then((organization) => {
|
||||||
|
this.setState({
|
||||||
|
organization: organization,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default UserListPage;
|
export default UserListPage;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user