PMCORE-2352 User extended attributes PMCORE-2247

This commit is contained in:
Roly Rudy Gutierrez Pinto
2020-12-16 19:47:59 -04:00
parent 9311905f74
commit d57a3ac932
65 changed files with 39216 additions and 153 deletions

View File

@@ -3,7 +3,15 @@
global $G_PUBLISH;
$G_PUBLISH = new Publisher();
try {
echo file_get_contents(PATH_HOME . "public_html/lib/authenticationSources/index.html");
$conf = new Configurations();
$pageSize = $conf->getEnvSetting('casesListRowNumber');
$pageSize = empty($pageSize) ? 25 : $pageSize;
$lang = defined("SYS_LANG") ? SYS_LANG : "en";
$html = file_get_contents(PATH_HTML . "lib/authenticationSources/index.html");
$html = str_replace("var pageSize=10;", "var pageSize={$pageSize};", $html);
$html = str_replace("translation.en.js", "translation.{$lang}.js", $html);
echo $html;
} catch (Exception $e) {
$message = [
'MESSAGE' => $e->getMessage()

View File

@@ -6,7 +6,11 @@
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title><%= htmlWebpackPlugin.options.title %></title>
<!-- These are default values, then they are overridden when processmaker runs -->
<script type="text/javascript" src="/js/ext/translation.en.js"></script>
<script type="text/javascript">
var pageSize=10;
</script>
</head>
<body>
<noscript>

View File

@@ -102,7 +102,7 @@
saveNewConnection(form) {
let formData = this.$refs.newConnection.formToFormData(form);
axios.post(this.$root.baseUrl() + "ldapAdvancedProxy.php?functionAccion=ldapSave", formData)
axios.post(this.$root.baseUrl() + "authSources/ldapAdvancedProxy.php?functionAccion=ldapSave", formData)
.then(response => {
response;
this.$refs.authenticationSources.refresh();

View File

@@ -97,7 +97,7 @@
},
data() {
return {
baseUrl: this.$root.baseUrl() + "/authSources_Ajax?action=authSourcesList",
baseUrl: this.$root.baseUrl() + "authSources/authSources_Ajax?action=authSourcesList",
columns: [
"AUTH_SOURCE_NAME",
"AUTH_SOURCE_PROVIDER",
@@ -140,7 +140,7 @@
noResults: this.$root.translation("ID_NO_MATCHING_RECORDS"),
loading: this.$root.translation("ID_LOADING_GRID")
},
perPage: 5,
perPage: "pageSize" in window ? window.pageSize : 5,
perPageValues: [],
sortIcon: {
is: "glyphicon-sort",
@@ -194,7 +194,7 @@
let formData = new FormData();
formData.append("action", "deleteAuthSource");
formData.append("auth_uid", row.AUTH_SOURCE_UID);
axios.post(this.$root.baseUrl() + "authSources_Ajax", formData)
axios.post(this.$root.baseUrl() + "authSources/authSources_Ajax", formData)
.then(response => {
response;
this.refresh();
@@ -253,11 +253,11 @@
},
syncGroups(row) {
//the return action is in: processmaker/workflow/engine/templates/authSources/authSourcesSynchronize.js
location.href = this.$root.baseUrl() + "authSourcesSynchronize?authUid=" + row.AUTH_SOURCE_UID + "&tab=synchronizeGroups";
location.href = this.$root.baseUrl() + "authSources/authSourcesSynchronize?authUid=" + row.AUTH_SOURCE_UID + "&tab=synchronizeGroups";
},
syncDepartments(row) {
//the return action is in: processmaker/workflow/engine/templates/authSources/authSourcesSynchronize.js
location.href = this.$root.baseUrl() + "authSourcesSynchronize?authUid=" + row.AUTH_SOURCE_UID + "&tab=synchronizeDepartments";
location.href = this.$root.baseUrl() + "authSources/authSourcesSynchronize?authUid=" + row.AUTH_SOURCE_UID + "&tab=synchronizeDepartments";
},
optionSaveButton(fileContent) {
this.$refs['as-b-modal-upload-file'].hide();

View File

@@ -11,7 +11,7 @@
<b-form-group :label="$root.translation('ID_NAME')">
<b-form-input v-model="form.name"
:state="validateState('name')"
placeholder=""/>
autocomplete="off"/>
<b-form-invalid-feedback>{{$root.translation('ID_IS_REQUIRED')}}</b-form-invalid-feedback>
</b-form-group>
<b-form-group :label="$root.translation('ID_TYPE')">
@@ -28,13 +28,13 @@
<b-form-group :label="$root.translation('ID_SERVER_ADDRESS')">
<b-form-input v-model="form.serverAddress"
:state="validateState('serverAddress')"
placeholder=""/>
autocomplete="off"/>
<b-form-invalid-feedback>{{$root.translation('ID_IS_REQUIRED')}}</b-form-invalid-feedback>
</b-form-group>
<b-form-group :label="$root.translation('ID_PORT')">
<b-form-input v-model="form.port"
:state="validateState('port')"
placeholder=""/>
autocomplete="off"/>
<b-form-invalid-feedback>{{$root.translation('ID_IS_REQUIRED')}}</b-form-invalid-feedback>
</b-form-group>
<b-form-group :label="$root.translation('ID_ENABLE_AUTOMATIC_REGISTER')"
@@ -60,11 +60,12 @@
</b-form-group>
<b-form-group :label="$root.translation('ID_BASE_DN')">
<b-form-input v-model="form.baseDN"
placeholder="dc=business,dc=net"/>
placeholder="dc=business,dc=net"
autocomplete="off"/>
</b-form-group>
<b-form-group :label="$root.translation('ID_INACTIVE_USERS')">
<b-form-input v-model="form.inactiveUsers"
placeholder=""/>
autocomplete="off"/>
</b-form-group>
<b-form-group :label="$root.translation('ID_ROLE')">
<b-form-select v-model="form.role"
@@ -81,40 +82,41 @@
<b-form-group :label="$root.translation('ID_USERNAME')">
<b-form-input v-model="form.userName"
:state="validateState('userName')"
placeholder=""/>
autocomplete="off"/>
<b-form-invalid-feedback>{{$root.translation('ID_IS_REQUIRED')}}</b-form-invalid-feedback>
</b-form-group>
<b-form-group :label="$root.translation('ID_PASSWORD')">
<b-form-input v-model="form.password"
:state="validateState('password')"
type="password"/>
type="password"
autocomplete="off"/>
<b-form-invalid-feedback>{{$root.translation('ID_IS_REQUIRED')}}</b-form-invalid-feedback>
</b-form-group>
<b-form-group :label="$root.translation('ID_USER_IDENTIFIER')">
<b-form-input v-model="form.userIdentifier"
placeholder=""
autocomplete="off"
readonly/>
</b-form-group>
<b-form-group :label="$root.translation('ID_GROUP_IDENTIFIER')">
<b-form-input v-model="form.groupIdentifier"
placeholder=""
autocomplete="off"
readonly/>
</b-form-group>
<b-form-group :label="$root.translation('ID_FILTER_TO_SEARCH_USERS')">
<b-form-input v-model="form.filterToSearchUsers"
placeholder=""/>
autocomplete="off"/>
</b-form-group>
<b-form-group :label="$root.translation('ID_USER_CLASS_IDENTIFIER')">
<b-form-input v-model="form.userClassIdentifier"
placeholder=""/>
autocomplete="off"/>
</b-form-group>
<b-form-group :label="$root.translation('ID_GROUP_CLASS_IDENTIFIER')">
<b-form-input v-model="form.groupClassIdentifier"
placeholder=""/>
autocomplete="off"/>
</b-form-group>
<b-form-group :label="$root.translation('ID_DEPARTMENT_CLASS_IDENTIFIER')">
<b-form-input v-model="form.departmentClassIdentifier"
placeholder=""/>
autocomplete="off"/>
</b-form-group>
</b-col>
</b-row>
@@ -270,12 +272,12 @@
test(form) {
let formDataForName = new FormData();
formDataForName.append("AUTH_SOURCE_NAME", form.name);
axios.post(this.$root.baseUrl() + "ldapAdvancedProxy.php?functionAccion=ldapVerifyName", formDataForName)
axios.post(this.$root.baseUrl() + "authSources/ldapAdvancedProxy.php?functionAccion=ldapVerifyName", formDataForName)
.then(response => {
//the name is valid
if (response.data.row === false || (this.form.uid !== "" && typeof this.form.uid === "string")) {
let formData = this.formToFormData(form);
axios.post(this.$root.baseUrl() + "ldapAdvancedProxy.php?functionAccion=ldapTestConnection", formData)
axios.post(this.$root.baseUrl() + "authSources/ldapAdvancedProxy.php?functionAccion=ldapTestConnection", formData)
.then(response => {
//test is successful
if (response.data.status === "OK") {

View File

@@ -141,7 +141,7 @@
//validation name
let formData = new FormData();
formData.append("AUTH_SOURCE_NAME", this.fileContent.AUTH_SOURCE_NAME);
axios.post(this.$root.baseUrl() + "ldapAdvancedProxy.php?functionAccion=ldapVerifyName", formData)
axios.post(this.$root.baseUrl() + "authSources/ldapAdvancedProxy.php?functionAccion=ldapVerifyName", formData)
.then(response => {
this.newName = response.data.row === false;
this.validationResult = response.data;

View File

@@ -12,32 +12,20 @@
:data="rows">
<div slot="icons"
slot-scope="props">
<b-button :id="'ma-b-button-tooltip-'+props.index"
variant="light"
size="sm"
class="mb-2">
<b-icon icon="three-dots-vertical" aria-hidden="true"/>
</b-button>
<b-tooltip :target="'ma-b-button-tooltip-'+props.index"
triggers="hover focus click"
custom-class="custom-tooltip"
placement="left"
variant="light">
<b-button-group>
<b-button @click="editAttribute(props.row,props.index)"
v-b-tooltip.hover
:title="$root.translation('ID_EDIT_ATTRIBUTE')"
variant="light">
<b-icon icon="pencil-fill" aria-hidden="true" variant="info"/>
</b-button>
<b-button @click="deleteAttribute(props.index,props.row)"
v-b-tooltip.hover
:title="$root.translation('ID_DELETE_ATTRIBUTE')"
variant="light">
<b-icon icon="trash" aria-hidden="true" variant="danger"/>
</b-button>
</b-button-group>
</b-tooltip>
<b-button-group>
<b-button @click="editAttribute(props.row,props.index)"
v-b-tooltip.hover
:title="$root.translation('ID_EDIT_ATTRIBUTE')"
variant="light">
<b-icon icon="pencil-fill" aria-hidden="true" variant="info"/>
</b-button>
<b-button @click="deleteAttribute(props.index,props.row)"
v-b-tooltip.hover
:title="$root.translation('ID_DELETE_ATTRIBUTE')"
variant="light">
<b-icon icon="trash" aria-hidden="true" variant="danger"/>
</b-button>
</b-button-group>
</div>
</v-client-table>
<b-modal id="messageForDeleteAttribute"

View File

@@ -7,7 +7,8 @@
<b-col>
<b-form-group :label="$root.translation('ID_ROLE')">
<b-form-select v-model="form.attributeRole"
:options="roles"/>
:options="roles"
@change="changeRoles"/>
</b-form-group>
<b-form-group :label="$root.translation('ID_PROCESSMAKER_USER_FIELD')" description="">
<b-form-select v-model="form.attributeUser"
@@ -15,8 +16,8 @@
</b-form-group>
<b-form-group :label="$root.translation('ID_LDAP_ATTRIBUTE')">
<b-form-input v-model="form.attributeLdap"
:state="validateState('attributeLdap')"
placeholder=""/>
:state="true"
autocomplete="off"/>
<b-form-invalid-feedback>{{$root.translation('ID_IS_REQUIRED')}}</b-form-invalid-feedback>
</b-form-group>
</b-col>
@@ -35,6 +36,7 @@
</template>
<script>
import axios from "axios"
import { validationMixin } from "vuelidate"
import { required } from "vuelidate/lib/validators"
import titleSection from "./titleSection.vue"
@@ -56,38 +58,20 @@
index: null,
attributeLdap: "",
attributeRole: "",
attributeUser: "USR_FIRSTNAME"
attributeUser: ""
},
roles: [
{value: "", text: "All"},
{value: "PROCESSMAKER_ADMIN", text: this.$root.translation("ID_SYSTEM_ADMINISTRATOR")},
{value: "PROCESSMAKER_MANAGER", text: this.$root.translation("ID_MANAGER")},
{value: "PROCESSMAKER_OPERATOR", text: this.$root.translation("ID_OPERATOR")}
],
userAttributes: [
{value: "USR_FIRSTNAME", text: "USR_FIRSTNAME"},
{value: "USR_LASTNAME", text: "USR_LASTNAME"},
{value: "USR_EMAIL", text: "USR_EMAIL"},
{value: "USR_DUE_DATE", text: "USR_DUE_DATE"},
{value: "USR_STATUS", text: "USR_STATUS"},
{value: "USR_STATUS_ID", text: "USR_STATUS_ID"},
{value: "USR_ADDRESS", text: "USR_ADDRESS"},
{value: "USR_PHONE", text: "USR_PHONE"},
{value: "USR_FAX", text: "USR_FAX"},
{value: "USR_CELLULAR", text: "USR_CELLULAR"},
{value: "USR_ZIP_CODE", text: "USR_ZIP_CODE"},
{value: "USR_POSITION", text: "USR_POSITION"},
{value: "USR_BIRTHDAY", text: "USR_BIRTHDAY"},
{value: "USR_COST_BY_HOUR", text: "USR_COST_BY_HOUR"},
{value: "USR_UNIT_COST", text: "USR_UNIT_COST"},
{value: "USR_PMDRIVE_FOLDER_UID", text: "USR_PMDRIVE_FOLDER_UID"},
{value: "USR_BOOKMARK_START_CASES", text: "USR_BOOKMARK_START_CASES"},
{value: "USR_TIME_ZONE", text: "USR_TIME_ZONE"},
{value: "USR_DEFAULT_LANG", text: "USR_DEFAULT_LANG"},
{value: "USR_LAST_LOGIN", text: "USR_LAST_LOGIN"}
]
roles: [{
value: "", text: "All"
}],
userAttributes: []
};
},
mounted() {
let promise = this.getRolesList();
promise.then(response => {
this.changeRoles();
});
},
methods: {
validateState(name) {
const {$dirty, $error} = this.$v.form[name];
@@ -111,8 +95,58 @@
index: null,
attributeLdap: "",
attributeRole: "",
attributeUser: "USR_FIRSTNAME"
attributeUser: ""
};
},
changeRoles() {
let formData = new FormData();
formData.append("option", "listByRol");
formData.append("rolCode", this.form.attributeRole);
return axios.post(this.$root.baseUrl() + "userExtendedAttributes/index", formData)
.then(response => {
response;
let data = [{
value: "",
text: this.$root.translation('ID_SELECTED_FIELD')
}];
for (let i in response.data.data) {
data.push({
value: response.data.data[i].value,
text: response.data.data[i].text
});
}
this.userAttributes = data;
})
.catch(error => {
error;
})
.finally(() => {
});
},
getRolesList() {
let formData = new FormData();
formData.append("request", "allRoles");
return axios.post(this.$root.baseUrl() + "roles/roles_Ajax", formData)
.then(response => {
response;
let data = [{
value: "",
text: this.$root.translation('ID_ALL')
}];
for (let i in response.data) {
data.push({
value: response.data[i].ROL_CODE,
text: response.data[i].ROL_NAME
});
}
this.roles = data;
})
.catch(error => {
error;
})
.finally(() => {
});
}
}
}

View File

@@ -27,7 +27,7 @@ new Vue({
return text;
},
baseUrl() {
return "../authSources/";
return "../";
}
}
}).$mount('#app');