mirror of
https://git.proxmox.com/git/proxmox-widget-toolkit
synced 2025-05-29 17:16:11 +00:00
window/AuthEditBase: handle differenc config api urls
necessary for pbs. also give an option to use the type as url path e.g. /config/access/<TYPE>/<ID> Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
parent
ff8ced046a
commit
335633d208
@ -7,16 +7,23 @@ Ext.define('Proxmox.window.AuthEditBase', {
|
|||||||
labelWidth: 120,
|
labelWidth: 120,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
baseurl: '/access/domains',
|
||||||
|
useTypeInUrl: false,
|
||||||
|
|
||||||
initComponent: function() {
|
initComponent: function() {
|
||||||
var me = this;
|
var me = this;
|
||||||
|
|
||||||
me.isCreate = !me.realm;
|
me.isCreate = !me.realm;
|
||||||
|
|
||||||
|
me.url = `/api2/extjs${me.baseUrl}`;
|
||||||
|
if (me.useTypeInUrl) {
|
||||||
|
me.url += `/${me.authType}`;
|
||||||
|
}
|
||||||
|
|
||||||
if (me.isCreate) {
|
if (me.isCreate) {
|
||||||
me.url = '/api2/extjs/access/domains';
|
|
||||||
me.method = 'POST';
|
me.method = 'POST';
|
||||||
} else {
|
} else {
|
||||||
me.url = '/api2/extjs/access/domains/' + me.realm;
|
me.url += `/${me.realm}`;
|
||||||
me.method = 'PUT';
|
me.method = 'PUT';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -76,7 +83,8 @@ Ext.define('Proxmox.window.AuthEditBase', {
|
|||||||
success: function(response, options) {
|
success: function(response, options) {
|
||||||
var data = response.result.data || {};
|
var data = response.result.data || {};
|
||||||
// just to be sure (should not happen)
|
// just to be sure (should not happen)
|
||||||
if (data.type !== me.authType) {
|
// only check this when the type is not in the api path
|
||||||
|
if (!me.useTypeInUrl && data.type !== me.authType) {
|
||||||
me.close();
|
me.close();
|
||||||
throw "got wrong auth type";
|
throw "got wrong auth type";
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user