feat(Docuware): refs #8066 add username and password
gitea/salix/pipeline/pr-master There was a failure building this commit
Details
gitea/salix/pipeline/pr-master There was a failure building this commit
Details
This commit is contained in:
parent
952f8f3dfc
commit
9695fea48f
|
@ -9,15 +9,16 @@ module.exports = Self => {
|
||||||
*/
|
*/
|
||||||
Self.getOptions = async() => {
|
Self.getOptions = async() => {
|
||||||
const {url, username, password} = await Self.app.models.DocuwareConfig.findOne();
|
const {url, username, password} = await Self.app.models.DocuwareConfig.findOne();
|
||||||
const {IdentityServiceUrl} = await axios.get(`${url}/Home/IdentityServiceInfo`);
|
const {data: {IdentityServiceUrl}} = await axios.get(`${url}/Home/IdentityServiceInfo`);
|
||||||
const {token_endpoint} = await axios.get(`${IdentityServiceUrl}/.well-known/openid-configuration`);
|
const {data: {token_endpoint}} = await axios.get(`${IdentityServiceUrl}/.well-known/openid-configuration`);
|
||||||
const {access_token} = await axios.post(token_endpoint, {
|
const data = await axios.post(token_endpoint, JSON.stringify({
|
||||||
grant_type: 'password',
|
grant_type: 'password',
|
||||||
scope: 'docuware.platform',
|
scope: 'docuware.platform',
|
||||||
client_id: 'docuware.platform.net.client',
|
client_id: 'docuware.platform.net.client',
|
||||||
username, // falta añadirlos
|
username,
|
||||||
password // falta añadirlos
|
password
|
||||||
});
|
}));
|
||||||
|
console.log('data: ', data);
|
||||||
|
|
||||||
const headers = {
|
const headers = {
|
||||||
headers: {
|
headers: {
|
||||||
|
@ -42,8 +43,8 @@ module.exports = Self => {
|
||||||
* @return {number} - The fileCabinet id
|
* @return {number} - The fileCabinet id
|
||||||
*/
|
*/
|
||||||
Self.getDialog = async(code, action, fileCabinetId) => {
|
Self.getDialog = async(code, action, fileCabinetId) => {
|
||||||
if (!process.env.NODE_ENV)
|
// if (!process.env.NODE_ENV)
|
||||||
return Math.floor(Math.random() + 100);
|
// return Math.floor(Math.random() + 100);
|
||||||
|
|
||||||
const docuwareInfo = await Self.app.models.Docuware.findOne({
|
const docuwareInfo = await Self.app.models.Docuware.findOne({
|
||||||
where: {
|
where: {
|
||||||
|
@ -69,8 +70,8 @@ module.exports = Self => {
|
||||||
* @return {number} - The fileCabinet id
|
* @return {number} - The fileCabinet id
|
||||||
*/
|
*/
|
||||||
Self.getFileCabinet = async code => {
|
Self.getFileCabinet = async code => {
|
||||||
if (!process.env.NODE_ENV)
|
// if (!process.env.NODE_ENV)
|
||||||
return Math.floor(Math.random() + 100);
|
// return Math.floor(Math.random() + 100);
|
||||||
|
|
||||||
const options = await Self.getOptions();
|
const options = await Self.getOptions();
|
||||||
const docuwareInfo = await Self.app.models.Docuware.findOne({
|
const docuwareInfo = await Self.app.models.Docuware.findOne({
|
||||||
|
@ -95,7 +96,7 @@ module.exports = Self => {
|
||||||
* @return {object} - The data
|
* @return {object} - The data
|
||||||
*/
|
*/
|
||||||
Self.get = async(code, filter, parse) => {
|
Self.get = async(code, filter, parse) => {
|
||||||
if (!process.env.NODE_ENV) return;
|
// if (!process.env.NODE_ENV) return;
|
||||||
|
|
||||||
const options = await Self.getOptions();
|
const options = await Self.getOptions();
|
||||||
const fileCabinetId = await Self.getFileCabinet(code);
|
const fileCabinetId = await Self.getFileCabinet(code);
|
||||||
|
@ -118,7 +119,7 @@ module.exports = Self => {
|
||||||
* @return {object} - The data
|
* @return {object} - The data
|
||||||
*/
|
*/
|
||||||
Self.getById = async(code, id, parse) => {
|
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({
|
const docuwareInfo = await Self.app.models.Docuware.findOne({
|
||||||
fields: ['findById'],
|
fields: ['findById'],
|
||||||
|
|
|
@ -18,15 +18,12 @@
|
||||||
},
|
},
|
||||||
"cookie": {
|
"cookie": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"acls": [
|
"username": {
|
||||||
{
|
"type": "string"
|
||||||
"property": "*",
|
},
|
||||||
"accessType": "*",
|
"password": {
|
||||||
"principalType": "ROLE",
|
"type": "string"
|
||||||
"principalId": "$everyone",
|
}
|
||||||
"permission": "ALLOW"
|
|
||||||
}
|
}
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
Loading…
Reference in New Issue