| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135 |
- import { Container } from 'unstated';
- import loggerFactory from '@alias/logger';
- // eslint-disable-next-line no-unused-vars
- const logger = loggerFactory('growi:security:AdminLdapSecurityContainer');
- /**
- * Service container for admin security page (SecurityLdapSetting.jsx)
- * @extends {Container} unstated Container
- */
- export default class AdminLdapSecurityContainer extends Container {
- constructor(appContainer) {
- super();
- this.appContainer = appContainer;
- this.state = {
- // TODO GW-583 set value
- serverUrl: '',
- ldapBindMode: 'manager',
- ldapBindDN: '',
- ldapBindDNPassword: '',
- ldapSearchFilter: '',
- ldapAttrMapUsername: '',
- cbSameUsernameTreatedAsIdenticalUser: false,
- ldapAttrMapMail: '',
- ldapAttrMapName: '',
- ldapGroupSearchBase: '',
- ldapGroupSearchFilter: '',
- ldapGroupDnProperty: '',
- };
- this.init();
- }
- init() {
- // TODO GW-583 fetch config value with api
- }
- /**
- * Workaround for the mangling in production build to break constructor.name
- */
- static getClassName() {
- return 'AdminLdapSecurityContainer';
- }
- /**
- * Change server url
- */
- changeServerUrl(inputValue) {
- this.setState({ serverUrl: inputValue });
- }
- /**
- * Change ldap bind mode
- */
- changeLdapBindMode(mode) {
- this.setState({ bindMode: mode });
- }
- /**
- * Change bind DN
- */
- changeBindDN(inputValue) {
- this.setState({ bindDN: inputValue });
- }
- /**
- * Change bind DN password
- */
- changeBindDNPassword(inputValue) {
- this.setState({ bindDNPassword: inputValue });
- }
- /**
- * Change search filter
- */
- changeSearchFilter(inputValue) {
- this.setState({ searchFilter: inputValue });
- }
- /**
- * Change attr map username
- */
- changeAttrMapUsername(inputValue) {
- this.setState({ attrMapUsername: inputValue });
- }
- /**
- * Switch cb same username treated as identical user
- */
- switchCbSameUsernameTreatedAsIdenticalUser() {
- this.setState({ cbSameUsernameTreatedAsIdenticalUser: !this.state.cbSameUsernameTreatedAsIdenticalUser });
- }
- /**
- * Change attr map email
- */
- changeAttrMapMail(inputValue) {
- this.setState({ attrMapMail: inputValue });
- }
- /**
- * Change attr map name
- */
- changeAttrMapName(inputValue) {
- this.setState({ attrMapName: inputValue });
- }
- /**
- * Change group search base
- */
- changeGroupSearchBase(inputValue) {
- this.setState({ groupSearchBase: inputValue });
- }
- /**
- * Change group search filter
- */
- changeGroupSearchFilter(inputValue) {
- this.setState({ groupSearchFilter: inputValue });
- }
- /**
- * Change group dn property
- */
- changeGroupDnProperty(inputValue) {
- this.setState({ groupDnProperty: inputValue });
- }
- }
|