master #3125

Merged
alexm merged 13 commits from master into test 2024-10-18 05:09:33 +00:00
3 changed files with 22 additions and 22 deletions
Showing only changes of commit 9695fea48f - Show all commits

View File

@ -9,15 +9,16 @@ module.exports = Self => {
*/
Self.getOptions = async() => {
const {url, username, password} = await Self.app.models.DocuwareConfig.findOne();
const {IdentityServiceUrl} = await axios.get(`${url}/Home/IdentityServiceInfo`);
const {token_endpoint} = await axios.get(`${IdentityServiceUrl}/.well-known/openid-configuration`);
const {access_token} = await axios.post(token_endpoint, {
const {data: {IdentityServiceUrl}} = await axios.get(`${url}/Home/IdentityServiceInfo`);
const {data: {token_endpoint}} = await axios.get(`${IdentityServiceUrl}/.well-known/openid-configuration`);
const data = await axios.post(token_endpoint, JSON.stringify({
grant_type: 'password',
scope: 'docuware.platform',
client_id: 'docuware.platform.net.client',
username, // falta añadirlos
password // falta añadirlos
});
username,
password
}));
console.log('data: ', data);
const headers = {
headers: {
@ -42,8 +43,8 @@ module.exports = Self => {
* @return {number} - The fileCabinet id
*/
Self.getDialog = async(code, action, fileCabinetId) => {
if (!process.env.NODE_ENV)
return Math.floor(Math.random() + 100);
// if (!process.env.NODE_ENV)
// return Math.floor(Math.random() + 100);
const docuwareInfo = await Self.app.models.Docuware.findOne({
where: {
@ -69,8 +70,8 @@ module.exports = Self => {
* @return {number} - The fileCabinet id
*/
Self.getFileCabinet = async code => {
if (!process.env.NODE_ENV)
return Math.floor(Math.random() + 100);
// if (!process.env.NODE_ENV)
// return Math.floor(Math.random() + 100);
const options = await Self.getOptions();
const docuwareInfo = await Self.app.models.Docuware.findOne({
@ -95,7 +96,7 @@ module.exports = Self => {
* @return {object} - The data
*/
Self.get = async(code, filter, parse) => {
if (!process.env.NODE_ENV) return;
// if (!process.env.NODE_ENV) return;
const options = await Self.getOptions();
const fileCabinetId = await Self.getFileCabinet(code);
@ -118,7 +119,7 @@ module.exports = Self => {
* @return {object} - The data
*/
Self.getById = async(code, id, parse) => {
if (!process.env.NODE_ENV) return;
// if (!process.env.NODE_ENV) return;
const docuwareInfo = await Self.app.models.Docuware.findOne({
fields: ['findById'],

View File

@ -18,15 +18,12 @@
},
"cookie": {
"type": "string"
},
"username": {
"type": "string"
},
"password": {
"type": "string"
}
},
"acls": [
{
"property": "*",
"accessType": "*",
"principalType": "ROLE",
"principalId": "$everyone",
"permission": "ALLOW"
}
]
}
}

View File

@ -0,0 +1,2 @@
ALTER TABLE vn.docuwareConfig ADD IF NOT EXISTS username varchar(100) NULL;
ALTER TABLE vn.docuwareConfig ADD IF NOT EXISTS password varchar(100) NULL;