protected void setPermissionUDF(SessionContext sc, String newUDFId, String clientUdfId)
            throws GranException {
        // скопировать права с поля Клиент
        String incidentsRoot = KernelManager.getTask().findByNumber("50");
        Set<SecuredPrstatusBean> prstatusSet = new TreeSet<SecuredPrstatusBean>(AdapterManager.getInstance().getSecuredPrstatusAdapterManager().getAvailablePrstatusList(sc, sc.getUserId()));
        for (SecuredPrstatusBean spb : prstatusSet) {
            if (spb.isAllowedByACL() || spb.getUser().getSecure().allowedByACL(incidentsRoot)) {
                List<String> types = AdapterManager.getInstance().getSecuredUDFAdapterManager().getUDFRuleList(sc, spb.getId(), clientUdfId);
                KernelManager.getUdf().resetUDFRule(newUDFId, spb.getId());
                for (String type: types)
                    KernelManager.getUdf().setUDFRule(newUDFId, spb.getId(), type);
            }
        }


        // для mstatus нужно отдельно доставать
        List<String> editableIds = KernelManager.getUdf().getOperationsWhereUDFIsEditable(clientUdfId);
        List<String> viewableIds = KernelManager.getUdf().getOperationsWhereUDFIsViewable(clientUdfId);

        for (String mstatusId: editableIds)
            KernelManager.getUdf().setMstatusUDFRule(newUDFId, mstatusId, CategoryConstants.EDIT_ALL);

        for (String mstatusId: viewableIds)
            KernelManager.getUdf().setMstatusUDFRule(newUDFId, mstatusId, CategoryConstants.VIEW_ALL);
    }