diff --git a/web/ASC.Web.Client/src/components/pages/Settings/categories/security/accessRights.js b/web/ASC.Web.Client/src/components/pages/Settings/categories/security/accessRights.js index e03c12dd40..1ab0a5d25d 100644 --- a/web/ASC.Web.Client/src/components/pages/Settings/categories/security/accessRights.js +++ b/web/ASC.Web.Client/src/components/pages/Settings/categories/security/accessRights.js @@ -121,20 +121,26 @@ class PureAccessRights extends Component { } componentDidMount() { - const { getListAdmins, getListUsers, getUserById, ownerId } = this.props; + const { + getListAdmins, + getListUsers, + getUserById, + ownerId, + productId + } = this.props; getUserById(ownerId).catch(error => { - toastr.error("accessRights getUserById", error); + toastr.error(error); //console.log("accessRights getUserById", error); }); getListUsers().catch(error => { - toastr.error("accessRights getListAdmins", error); + toastr.error(error); //console.log("accessRights getListAdmins", error); }); - getListAdmins().catch(error => { - toastr.error("accessRights getListAdmins", error); + getListAdmins(productId).catch(error => { + toastr.error(error); //console.log("accessRights getListAdmins", error); }); } @@ -176,6 +182,12 @@ class PureAccessRights extends Component { const { showSelector, advancedOptions } = this.state; const OwnerOpportunities = t("AccessRightsOwnerOpportunities").split("|"); + const countItems = [ + { key: 25, label: t("CountPerPage", { count: 25 }) }, + { key: 50, label: t("CountPerPage", { count: 50 }) }, + { key: 100, label: t("CountPerPage", { count: 100 }) } + ]; + return ( @@ -196,9 +208,12 @@ class PureAccessRights extends Component { {owner.displayName} - - {owner.department} - + {owner.groups && + owner.groups.map(group => ( + + {group.name} + + ))} @@ -233,7 +248,6 @@ class PureAccessRights extends Component { isOpen={showSelector} placeholder="placeholder" options={advancedOptions} - //options={this.AdvancedSelectorFunction(users)} onSearchChanged={this.onSearchUsers} //groups={groups} isMultiSelect={true} @@ -252,8 +266,8 @@ class PureAccessRights extends Component { ); const nameColor = @@ -270,13 +284,13 @@ class PureAccessRights extends Component { - {user.userName} + {user.displayName}
@@ -303,15 +317,20 @@ class PureAccessRights extends Component { {admins.length > 25 ? (
console.log("Prev")} - nextAction={() => console.log("Next")} - openDirection="bottom" + previousAction={() => console.log("previousAction")} + nextAction={() => console.log("nextAction")} onSelectPage={a => console.log(a)} onSelectCount={a => console.log(a)} + //pageItems={pageItems} + //disablePrevious={!filter.hasPrev()} + //disableNext={!filter.hasNext()} />
) : null} @@ -377,12 +396,22 @@ const AccessRights = props => { ); }; -const filterOwner = (users, ownerId) => +const filterUsers = (users, ownerId) => filter(users, function(f) { return f.id !== ownerId; }); const filterAdminUsers = users => { - return users.filter(user => user.listAdminModules === undefined); + const newArray = []; + users.map(user => { + if (user.listAdminModules !== undefined) { + if (!user.listAdminModules.includes("people")) { + newArray.push(user); + } + } else { + newArray.push(user); + } + }); + return newArray.filter(user => !user.isVisitor); }; const AdvancedSelectorFunction = users => @@ -396,12 +425,12 @@ const AdvancedSelectorFunction = users => function mapStateToProps(state) { const { ownerId } = state.auth.settings; const { admins, users } = state.settings; - const arrayUsers = filterOwner(users, ownerId); + const arrayUsers = filterUsers(users, ownerId); const filterArrayUsers = filterAdminUsers(arrayUsers); return { users: filterArrayUsers, - admins: filterOwner(admins, ownerId), + admins: filterUsers(admins, ownerId), productId: state.auth.modules[0].id, owner: state.settings.owner, ownerId, @@ -414,7 +443,8 @@ AccessRights.defaultProps = { admins: [], productId: "", ownerId: "", - owner: {} + owner: {}, + advancedOptions: [] }; AccessRights.propTypes = { @@ -422,7 +452,8 @@ AccessRights.propTypes = { admins: PropTypes.arrayOf(PropTypes.object), productId: PropTypes.string, ownerId: PropTypes.string, - owner: PropTypes.object + owner: PropTypes.object, + advancedOptions: PropTypes.arrayOf(PropTypes.object) }; export default connect( diff --git a/web/ASC.Web.Client/src/components/pages/Settings/locales/en/translation.json b/web/ASC.Web.Client/src/components/pages/Settings/locales/en/translation.json index a39087a85e..ecba7beb15 100644 --- a/web/ASC.Web.Client/src/components/pages/Settings/locales/en/translation.json +++ b/web/ASC.Web.Client/src/components/pages/Settings/locales/en/translation.json @@ -23,6 +23,8 @@ "SuccessfullySaveSettingsMessage": "Settings have been successfully updated", "NotFoundLanguage": "In case you cannot find your language in the list of the available ones, feel free to write to us at <1>{{supportEmail}} to take part in the translation and get up to 1 year free of charge.", "Settings": "Settings", + "PreviousPage": "Previous", + "NextPage": "Next", @@ -59,5 +61,6 @@ "Settings_integration": "Integration", "Settings_third-party-services": "Third-Party Services", "Settings_smtp-settings": "SMTP Settings", - "Settings_statistics": "Statistics" + "Settings_statistics": "Statistics", + "CountPerPage": "{{count}} per page" } \ No newline at end of file diff --git a/web/ASC.Web.Client/src/components/pages/Settings/locales/ru/translation.json b/web/ASC.Web.Client/src/components/pages/Settings/locales/ru/translation.json index 2621a0dcc5..b463ae7d10 100644 --- a/web/ASC.Web.Client/src/components/pages/Settings/locales/ru/translation.json +++ b/web/ASC.Web.Client/src/components/pages/Settings/locales/ru/translation.json @@ -22,6 +22,8 @@ "SuccessfullySaveSettingsMessage": "Настройки успешно обновлены", "NotFoundLanguage": "Если Вы не можете найти свой язык в списке доступных, Вы всегда можете написать нам по адресу <1>{{supportEmail}}, чтобы принять участие в переводе и получить до 1 года бесплатного использования.", "Settings": "Настройки", + "PreviousPage": "Предыдущая", + "NextPage": "Следующая", @@ -58,5 +60,6 @@ "Settings_integration": "Интеграция", "Settings_third-party-services": "Сторонние сервисы", "Settings_smtp-settings": "Настройки SMTP", - "Settings_statistics": "Статистика" + "Settings_statistics": "Статистика", + "CountPerPage": "{{count}} на странице" } \ No newline at end of file diff --git a/web/ASC.Web.Client/src/resourceConfig.json b/web/ASC.Web.Client/src/resourceConfig.json index d403dcdf96..9f2a6280a7 100644 --- a/web/ASC.Web.Client/src/resourceConfig.json +++ b/web/ASC.Web.Client/src/resourceConfig.json @@ -83,6 +83,10 @@ ], "PeopleResource": [ "Settings" + ], + "UserControlsCommonResource": [ + "NextPage", + "PreviousPage" ] } }, diff --git a/web/ASC.Web.Client/src/store/services/api.js b/web/ASC.Web.Client/src/store/services/api.js index ddbe70658c..62de2f8b6c 100644 --- a/web/ASC.Web.Client/src/store/services/api.js +++ b/web/ASC.Web.Client/src/store/services/api.js @@ -149,15 +149,17 @@ export function getPortalTimezones() { }); } -export function getUserList(role) { - let params = ""; - if(role === "admin") { - params = "/filter?isAdministrator=true"; - } - +export function getUserList() { return request({ method: "get", - url: `/people${params}` + url: `/people` + }); +} + +export function getProductAdminsList(productId) { + return request({ + method: "get", + url: `/settings/security/administrator/${productId}` }); } diff --git a/web/ASC.Web.Client/src/store/settings/actions.js b/web/ASC.Web.Client/src/store/settings/actions.js index 1f7e22099c..a61eb19e63 100644 --- a/web/ASC.Web.Client/src/store/settings/actions.js +++ b/web/ASC.Web.Client/src/store/settings/actions.js @@ -31,18 +31,20 @@ export function getListUsers() { }; } -export function getListAdmins() { +export function getListAdmins(productId) { return dispatch => { - return api.getUserList("admin").then(admins => dispatch(setAdmins(admins))); + return api + .getProductAdminsList(productId) + .then(admins => dispatch(setAdmins(admins))); }; } export function changeAdmins(userId, productId, isAdmin) { return dispatch => { - return api - .changeProductAdmin(userId, productId, isAdmin) - .then(() => dispatch(getListUsers())) - .then(() => dispatch(getListAdmins())); + return api.changeProductAdmin(userId, productId, isAdmin).then(() => { + dispatch(getListUsers()); + dispatch(getListAdmins(productId)); + }); }; }