【问题标题】:Kendo UI for Angular authenticationModelKendo UI for Angular authenticationModel
【发布时间】:2017-06-06 08:15:46
【问题描述】:

我是编程新手,我正在尝试使用 Progress Developer Studio 身份验证模型 (/WEB-INF/oeablSecurity-form-local.xml) 将 Progress 数据库与 Angular 项目的 KENDO UI 连接起来。当我使用匿名身份验证时,一切正常,但我无法使用用户名和密码进行表单身份验证。这是代码:

/// <reference path="progress/progress.d.ts" />

import { Component, ViewChild, Injectable } from '@angular/core';
import { Http } from '@angular/http';
import { Observable, BehaviorSubject } from 'rxjs/Rx';
import {
    GridComponent,
    GridDataResult,
    DataStateChangeEvent,
    // State
 } from '@progress/kendo-angular-grid';
 import {
     State,
     process
 } from '@progress/kendo-data-query';
import * as Progress from "./progress/progress";

let progress = Progress.progress;

/* Example service */
@Injectable()
export class CategoriesService extends BehaviorSubject<GridDataResult> {
    private tableName: string = 'Client';
    private jsdoPromise: Promise<Progress.progress.data.JSDO>;

    constructor(private http: Http) {
        super(null);

        const serviceURI = 'serviceURI';
        const catalogURI = 'catalogURI';

        let opts: Progress.progress.data.JSDOSessionOptions = {
            serviceURI: serviceURI,
        };
        let session = new progress.data.JSDOSession(opts);
        this.jsdoPromise = new Promise( (resolve, reject) => {
            session.login("", "").done(function (session: Progress.progress.data.JSDOSession, result: any, info: any) {
                console.log("session.login");
                session.addCatalog(catalogURI).then(() => {
                    resolve(new progress.data.JSDO('AdvClients'));
                });
            })
        })
    }
    public query(state: any): void {
        this.fetch(this.tableName, state)
            .subscribe(x => super.next(x));
    }
    private fetch(tableName: string, state: State): Observable<GridDataResult> {
        let that = this;
        let query = {
            skip: state.skip,
            top: state.take
        };
        let promise = new Promise((resolve, reject) => {
            this.jsdoPromise.then((jsdo) => {
                console.log("jsdoPromise.resolve");
                let afterFill = (jsdo: any, success: any, request: any) => {
                        jsdo.unsubscribe('AfterFill', afterFill, this);
                        if (success) {
                            let data = jsdo.getData();
                            if (query.top) {
                                let afterInvoke = (jsdo1: any, success1: any, request1: any): void => {
                                    jsdo.unsubscribe('AfterInvoke', 'count', afterInvoke, this);
                                    console.log("promise.resolve 1");
                                    resolve(<GridDataResult>{
                                        data: data,
                                        total: request1.response.numRecs
                                    });
                                };
                                jsdo.subscribe('AfterInvoke', 'count', afterInvoke, this);
                                jsdo.count(query);
                            } else {
                                console.log("promise.resolve 2");

                                resolve(<GridDataResult>{
                                    data: data,
                                    total: data.length
                                });
                            }
                        } else {
                            reject(new Error('Error while executing query'));
                        }
                    };
                jsdo.subscribe('AfterFill', afterFill, this);
                jsdo.fill(query);
            })
        });

        let result = Observable.fromPromise(promise)
            .map((ret: GridDataResult) => (<GridDataResult>{
                data: ret.data,
                total: ret.total
            }));

        return result;
    }
}

【问题讨论】:

    标签: kendo-ui-angular2


    【解决方案1】:

    我做到了。

    const serviceURI = 'http://ctc-server:8810/CtcIdea';
        const catalogURI = serviceURI + '/static/CtcIdeaService1.json';
    

    const authenticationModel = progress.data.Session.AUTH_TYPE_FORM;

        let opts: Progress.progress.data.JSDOSessionOptions = {
            serviceURI: serviceURI,
    

    authenticationModel:authenticationModel

        };
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-04-25
      • 2018-08-06
      • 1970-01-01
      • 2022-01-20
      • 2018-07-29
      • 2020-02-22
      • 1970-01-01
      • 2019-01-07
      相关资源
      最近更新 更多