ORG
In org.js
on user login:
if (employeeOnStaffType === 'PERMANENT') {
staffUnitID = staff['staffUnitID'] // permanentStaffUnit
employeeOnStaffID = staff['ID'] // permanent employeeOnStaff
parentID = staff['staffUnitID.parentID']
parentUnityEntity = staff['staffUnitID.parentID.mi_unityEntity']
permStaffUnitIDsArray.push(staffUnitID)
data.staffUnitFullName = staff['staffUnitID.fullName']
data.staffUnitName = staff['staffUnitID.name']
permanentOrgUnitIDs = tmpArr
} else if (employeeOnStaffType === 'TEMPORARY') {
currStaffUnitID = staff['staffUnitID']
currEmployeeOnStaffID = staff['ID']
tempStaffUnitIDsArray.push(currStaffUnitID)
tempEmployeeOnStaffIDsArray.push(currEmployeeOnStaffID)
currPositionObj = {
staffUnitID: staff['staffUnitID'],
employeeOnStaffID: staff['ID'],
staffUnitFullName: staff['staffUnitID.fullName'],
staffUnitName: staff['staffUnitID.name'],
employeeOnStaffDescription: staff['description']
}
tempPositionsArray.push(currPositionObj)
} else if (employeeOnStaffType === 'ASSISTANT') {
currStaffUnitID = staff['staffUnitID']
currEmployeeOnStaffID = staff['ID']
assistantStaffUnitIDsArray.push(currStaffUnitID)
assistantEmployeeOnStaffIDsArray.push(currEmployeeOnStaffID)
currPositionObj = {
staffUnitID: staff['staffUnitID'],
employeeOnStaffID: staff['ID'],
staffUnitFullName: staff['staffUnitID.fullName'],
staffUnitName: staff['staffUnitID.name'],
employeeOnStaffDescription: staff['description']
}
assistantPositionsArray.push(currPositionObj)
}
But what if employeeOnStaffType
- is neigher of the 3 cases (permanent / assistant / temp)?
For example, the MEMBER
(we discussed a while ago - keeping virtual departments, like committees, working groups, etc)?
Then "allXxxxxXxxxIDs" would not contain those assigments, and they won't be by default available in RLS / etc.
data.allStaffUnitIDs = tempStaffUnitIDsArray.join(',') // array of all (permanent + temporary + assistant) staffUnitIDs
tempEmployeeOnStaffIDsArray.push(employeeOnStaffID)
data.allEmployeeOnStaffIDs = tempEmployeeOnStaffIDsArray.join(',') // array of all (permanent + temporary + assistant) employeeOnStaffIds
data.tempPositions = JSON.stringify(tempPositionsArray) // stringified array ob temporary position objects: {staffUnitID, employeeOnStaffID}
data.assistantPositions = JSON.stringify(assistantPositionsArray) // stringified array ob assistant position objects: {staffUnitID, employeeOnStaffID}
It would be nice to have it fixed.
PS: For now I will workaround that, probably by overriding ORG.onUserLogin
. But I do believe it shall be in main version.