<commit_before>package org.cherchgk.actions.user;

import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ActionSupport;
import org.cherchgk.services.SecurityService;
import org.cherchgk.utils.ActionContextHelper;

/**
 * Действие удаления пользователя
 *
 * @author <NAME> (<EMAIL>)
 */
public class DeleteUserAction extends ActionSupport {

    private SecurityService securityService;

    public DeleteUserAction(SecurityService securityService) {
        this.securityService = securityService;
    }

    @Override
    public String execute() throws Exception {
        Long userId = Long.valueOf(ActionContextHelper.getRequestParameterValue("user.id"));
        securityService.deleteUser(userId);
        return Action.SUCCESS;
    }
}<commit_msg>В org.cherchgk.actions.user.DeleteUserAction.execute добавлена проверка прав на удаление пользователя.<commit_after>package org.cherchgk.actions.user;

import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.shiro.SecurityUtils;
import org.cherchgk.services.SecurityService;
import org.cherchgk.utils.ActionContextHelper;

/**
 * Действие удаления пользователя
 *
 * @author <NAME> (<EMAIL>)
 */
public class DeleteUserAction extends ActionSupport {

    private SecurityService securityService;

    public DeleteUserAction(SecurityService securityService) {
        this.securityService = securityService;
    }

    @Override
    public String execute() throws Exception {
        Long userId = Long.valueOf(ActionContextHelper.getRequestParameterValue("user.id"));
        if (SecurityUtils.getSubject().isPermitted("user:edit:" + userId)) {
            securityService.deleteUser(userId);
        }
        return Action.SUCCESS;
    }
}
{'fraction_non_alphanumeric': 0.0938032973280273, 'fraction_numerical': 0.0022740193291642978, 'mean_word_length': 4.349544072948328, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '5825867', 'n_tokens_mistral': 491, 'n_tokens_neox': 499, 'n_words': 94}