<commit_before>import React, { Component } from 'react';
import { connect } from 'react-redux';
import classNames from 'classnames/bind';
import PropTypes from 'prop-types';
import { activeProjectRoleSelector } from 'controllers/user';
import { canDeleteDashboard } from 'common/utils/permissions';
import { Icon } from 'components/main/icon';
import styles from './deleteColumn.scss';

const cx = classNames.bind(styles);

@connect((state) => ({
  projectRole: activeProjectRoleSelector(state),
}))
export class DeleteColumn extends Component {
  static propTypes = {
    value: PropTypes.object,
    customProps: PropTypes.object,
    projectRole: PropTypes.string,
  };
  static defaultProps = {
    value: {},
    customProps: {},
    projectRole: '',
  };
  render = () => {
    const {
      onDelete,
      currentUser: { userId, userRole },
    } = this.props.customProps;
    const { owner } = this.props.value;
    const deleteItemHandler = () => {
      onDelete(this.props.value);
    };

    return (
      <div className={cx('cell', 'with-button', 'delete')}>
        <div className={cx('icon-holder')}>
          {canDeleteDashboard(userRole, this.props.projectRole, userId === owner) && (
            <Icon type="icon-delete" onClick={deleteItemHandler} />
          )}
        </div>
      </div>
    );
  };
}<commit_msg>Check permission engine. Fixes<commit_after>import React, { Component } from 'react';
import { connect } from 'react-redux';
import classNames from 'classnames/bind';
import PropTypes from 'prop-types';
import { activeProjectRoleSelector } from 'controllers/user';
import { canDeleteDashboard } from 'common/utils/permissions';
import { Icon } from 'components/main/icon';
import styles from './deleteColumn.scss';

const cx = classNames.bind(styles);

@connect((state) => ({
  projectRole: activeProjectRoleSelector(state),
}))
export class DeleteColumn extends Component {
  static propTypes = {
    value: PropTypes.object,
    customProps: PropTypes.object,
    projectRole: PropTypes.string,
  };
  static defaultProps = {
    value: {},
    customProps: {},
    projectRole: '',
  };
  deleteItemHandler = () => {
    this.props.customProps.onDelete(this.props.value);
  };
  render = () => {
    const {
      currentUser: { userId, userRole },
    } = this.props.customProps;
    const { owner } = this.props.value;

    return (
      <div className={cx('cell', 'with-button', 'delete')}>
        <div className={cx('icon-holder')}>
          {canDeleteDashboard(userRole, this.props.projectRole, userId === owner) && (
            <Icon type="icon-delete" onClick={this.deleteItemHandler} />
          )}
        </div>
      </div>
    );
  };
}
{'fraction_non_alphanumeric': 0.14916512059369202, 'fraction_numerical': 0.0, 'mean_word_length': 3.3695299837925448, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3528279', 'n_tokens_mistral': 783, 'n_tokens_neox': 797, 'n_words': 173}