//< //Title: grantRemoveAccess.dxl //Author: //Date: //Brief: /*********************************************************** * * * ***********************************************************/ //Updated: /*********************************************************** * * * * ***********************************************************/ pragma runLim, 0 DB db DBE userListView DBE optionIndividualUser DBE optionAppendUsers DBE optionTestSpec DBE accessListView DBE moduleList DBE treeFrame DBE listFrame DBE itemTree DBE itemList Skip selectedItems = getSelectedItems () Skip items = create () Skip DBuserList = createString () Skip EngEmailList = create () Skip IVVEmailList = create () Buffer message = create; message = "" //For Testing... put(DBuserList, "TEST", "Engineering Lead") //put(DBuserList, "TEST","IV&V Lead") put(EngEmailList, 0, "james.ellis@ABC.com") put(IVVEmailList, 0, "james.ellis@ABC.com") int numItems = 0 //Regular Expression const Regexp TestSpec = regexp2 ".*/[TtEeSsTt].[Ss].*/.*" User u = null string Uname = null // Get Current User. u = find(); Uname = u.name; if(Uname != "Administrator") { if(!find(DBuserList,Uname)) { warningBox("You're not authorized to run this script!|\nPlease see you Administrator!") delete selectedItems delete items delete DBuserList delete TestSpec delete EngEmailList delete IVVEmailList delete message halt } } /********************************** RecordControl ***********************************/ bool RecordControl(Item I) { AccessRec ar bool found = false if(Uname == "Administrator") {found = true} else { string userGroup = null find(DBuserList,Uname,userGroup) for ar in I do { if(username(ar) == userGroup) { found = true break } } } return(found) }//End RecordControl() /********************************** CountSkip ***********************************/ int CountSkip(Skip in_skp) { int Count = 0 int Data = 0 for Data in in_skp do{Count++} return(Count) }//End CountSkip() /********************************** itemsSelected ***********************************/ bool itemsSelected() { bool ret = true if (CountSkip(items) < 1) {ret = false} return ret }//End itemsSelected. /********************************** userSelected ***********************************/ bool userSelected() { bool ret = false int i = 0 for (i = noElems (userListView); i >= 0 && !ret; i--) { if (selected (userListView, i)) {ret = true} } return ret }//End userSelected. /********************************** validation ***********************************/ bool validation() { bool ret = true Group LG = find("Engineering Lead") Group IG = find("IV&V Lead") if (Uname != "Administrator") { if(member(LG, u) && member(IG, u)) { errorBox(Uname " Cannot be apart of both Groups {Engineering/IV&V}!\nPlease see the Administrator!") ret = false } else { string userGroup = null if(!find(DBuserList,Uname,userGroup)) { errorBox(Uname " is not an authorized user!") ret = false } else if(member(LG, u)) { find(DBuserList,Uname,userGroup) if(userGroup != "Engineering Lead") { errorBox("Please see the Administrator {err: USERGROUP#1}") ret = false } } else if(member(IG, u)) { find(DBuserList,Uname,userGroup) if(userGroup != "IV&V Lead") { errorBox("Please see the Administrator {err: USERGROUP#2}") ret = false } } } } return ret }//End validation /********************************** optionCallback ***********************************/ void optionCallback (DBE win) { if(get(optionIndividualUser)) { int i //Loop through the module list. for (i = noElems (accessListView); i >= 0; i--) { //If the item is selected then remove it from list to process. if (getCheck (accessListView, i)) { setCheck(accessListView, i, false) } } inactive(accessListView) active(userListView) active(optionAppendUsers) } else { int i //Loop through the module list. for (i = noElems (userListView); i >= 0; i--) { //If the item is selected then remove it from list to process. if (selected (userListView, i)) { set (userListView, i,false) } } set(optionAppendUsers,false) active(accessListView) inactive(userListView) inactive(optionAppendUsers) } }//End optionCallback. /********************************** optionTestSpecCallback ***********************************/ void optionTestSpecCallback (DBE win) { if(get(optionTestSpec)) { int i = 0 //Loop through the module list. for (i = noElems (moduleList); i >= 0; i--) { if(!TestSpec get(moduleList, i)) { delete (items, item get (moduleList, i)) delete (moduleList, i) } } setCheck (accessListView, 0, false) setCheck (accessListView, 1, false) } else { int i = 0 //Loop through the module list. for (i = noElems (moduleList); i >= 0; i--) { if(TestSpec get(moduleList, i)) { delete (items, item get (moduleList, i)) delete (moduleList, i) } } setCheck (accessListView, 0, false) setCheck (accessListView, 1, false) } }//End optionTestSpecCallback. /********************************** permission (recursive) ***********************************/ Permission permission (AccessRec ar) { Permission returned = none if read(ar) then returned = returned | read if modify(ar) then returned = returned | modify if create(ar) then returned = returned | create if delete(ar) then returned = returned | delete if control(ar) then returned = returned | control return returned }//End permission. /********************************** permission (recursive) ***********************************/ string permission (Permission p){ string returned = "" if (p & read == read ) returned = returned "R" if (p & modify == modify ) returned = returned "M" if (p & create == create ) returned = returned "C" if (p & delete == delete ) returned = returned "D" if (p & control == control) returned = returned "A" if (returned == "" ) returned = "none" return returned }//End permission. /********************************** ReadOnly ***********************************/ bool ReadOnly(Item I) { bool ret = true AccessRec ar string userG = null int cnt = 0 for ar in all I do { userG = username(ar) " " permission(permission(ar)) if(isDefault(ar)) { if(permission(permission(ar)) != "R") { ret = false break } } else if(userG != "Engineering Lead RMCA" && userG != "IV&V Lead RMCA") { ret = false break } cnt++ } if (cnt < 2) {ret = false} return ret }//End ReadOnly. /********************************** freeResources ***********************************/ void freeResources() { //Free resources... delete selectedItems delete items delete DBuserList delete TestSpec delete EngEmailList delete IVVEmailList delete message refreshDBExplorer() }//End freeResources. /********************************** sortListView ***********************************/ int sortListView (string s1, string s2) {//Call back function to sort listViews. if (s1 == s2) { return 0 } else if (s1 > s2) { return 1 } else if (s1 < s2) { return -1 } }//End sortListView. /********************************** SetModAccess ***********************************/ void SetModAccess(Item m, Permission psn, string NameUser) { string err = set(m, psn, NameUser) // Set UserGroup/User. if (!null err){errorBox(fullName(m) "\n" err)} }//End SetModAccess(). /********************************** resetInhertance (recursive) ***********************************/ void Reset(Object obj) { bool IsInherited = false isAccessInherited(obj, IsInherited) if (!IsInherited and !isDeleted(obj) and canModify(obj)) { inherited(obj) specific(obj) } Object oChild // ** RECURSION ** for oChild in obj do { Reset(oChild) } }//End Reset(Obj) /********************************** resetInhertance (recursive) ***********************************/ void Reset(Module mod) { Object oTop // ** RECURSION ** for oTop in top(mod) do { Reset(oTop) } }//End Reset(Mod) /********************************** TurnOffShareable ***********************************/ void TurnOffShareable (DB win) { if (itemsSelected()) { Item I //Set shareable-edit off on the selected items. for I in items do { Module m = edit(fullName(I), false, true) // silent if(!null m) { Object o for o in entire m do {inherited o} save(m) close(m) }else{errorBox("{Null} Module Parameter!")} } infoBox("Done!") freeResources() destroy(db) db = null } //Warning user that no items are selected! else {warningBox("No module(s) selected to process!")} }//End TurnOffShareable. /********************************** applyUserGroup ***********************************/ void applyUserGroup(DB win) { string err = null string LEAD = null if (itemsSelected()) { Item I if (getCheck (accessListView, 0) || getCheck (accessListView, 1) || getCheck (accessListView, 2)) { //Loop through the items to apply access. for I in items do { if (type (I) != "Formal") {continue} // set access control to be specific rather than inherited. err = specific(I) if (!null err){errorBox(fullName(I) "\n" err)} //None is selected. if (getCheck (accessListView, 0)) { //ClearAccess AccessRec ar // Remove all access {user access}. for ar in all I do { string userGroup = null if (find(DBuserList,Uname,userGroup) || Uname == "Administrator") { if (!isDefault( ar ) && username(ar) != userGroup) {err = unset(I, username(ar)) if (!null err){errorBox(err)}} } } SetModAccess(I, read, null) // Everyone else (R). } if (getCheck (accessListView, 0) && !getCheck (accessListView, 1) && !getCheck (accessListView, 2)) { LEAD = "Engineering Lead" if (TestSpec fullName(I)) { LEAD = "IV&V Lead" } // Set UserGroup/User SetModAccess(I, control, LEAD) // (RMCA). err = setImplied(I, null) // Turn off Propagate access rights. //if (!null err){errorBox(err)} if (!null err){errorBox(fullName(I) "\n" err)} } if (getCheck (accessListView, 1)) { // Set UserGroup/User SetModAccess(I, control, "Engineering Lead") // (RMCA). err = setImplied(I, null) // Turn off Propagate access rights. //if (!null err){errorBox(err)} if (!null err){errorBox(fullName(I) "\n" err)} } if (getCheck (accessListView, 2)) { // Set UserGroup/User SetModAccess(I, control, "IV&V Lead") // (RMCA). err = setImplied(I, null) // Turn off Propagate access rights. if (!null err){errorBox(fullName(I) "\n" err)} } if (getCheck (accessListView, 3)) { // Set UserGroup/User SetModAccess(I, read|create|modify, "Application Engineer") // (RC). err = setImplied(I, delete) // Propagate access rights (MD). if (!null err){errorBox(fullName(I) "\n" err)} } if (getCheck (accessListView, 4)) { // Set UserGroup/User SetModAccess(I, read|create|modify, "Hardware Engineer") // (RC). err = setImplied(I, delete) // Propagate access rights (MD). if (!null err){errorBox(fullName(I) "\n" err)} } if (getCheck (accessListView, 5)) { if(get(optionTestSpec)) { // Set UserGroup/User SetModAccess(I, read|create|modify, "IV&V Engineer") // (RC). err = setImplied(I, delete) // Propagate access rights (MD). if (!null err){errorBox(fullName(I) "\n" err)} } else { SetModAccess(I, read|modify, "IV&V Engineer") // (RM). err = setImplied(I, null) // Turn off Propagate access rights. if (!null err){errorBox(fullName(I) "\n" err)} } } Module m = edit(fullName(I), false, true) if(!null m) { Reset(m) // Remove userGroup access. string userGroup = null find(DBuserList,Uname,userGroup) if ((userGroup == "Engineering Lead" && !getCheck (accessListView, 1) && getCheck (accessListView, 2)) || (userGroup == "IV&V Lead" && !getCheck (accessListView, 2) && getCheck (accessListView, 1)) || (!TestSpec fullName(I) && userGroup == "IV&V Lead" && !getCheck (accessListView, 2) && !getCheck (accessListView, 1))) { err = unset(m, userGroup) if (!null err) { errorBox(err) } } if (null err) { message += fullName(m) "\n" message += getURL(m) "\n" } save(m) close(m) }else{errorBox("{Null} "fullName(I)"!")} } infoBox ("Done!") }else {warningBox("{Null Parameters} Permissions!")} }else {warningBox("No module(s) selected to process!")} }//End applyAccess /********************************** applyUser ***********************************/ void applyUser (DB win) { string err = null if(itemsSelected()) { if (userSelected()) { Item I //Loop through the items to apply access. for I in items do { if (type (I) != "Formal") {continue} // set access control to be specific rather than inherited. err = specific(I) if (!null err){errorBox(fullName(I) "\n" err)} if(!get(optionAppendUsers)) { //ClearAccess AccessRec ar // Remove all access {user access}. for ar in all I do { string userGroup = null find(DBuserList,Uname,userGroup) if(Uname == "Administrator" && (username(ar) == "Engineering Lead" || username(ar) == "IV&V Lead")) {continue} else if(isDefault(ar)) {continue} else if(userGroup == username(ar)) {continue} err = unset(I, username(ar)) if (!null err){errorBox(err)} } SetModAccess(I, read, null) // Everyone else (R). } else { //Remove only Usergroups Group g bool ugDisabled string ugName for g in groupList do { ugDisabled = g.disabled if (!ugDisabled) { ugName = g.name string userGroup = null find(DBuserList,Uname,userGroup) if(Uname == "Administrator" && (ugName == "Engineering Lead" || ugName == "IV&V Lead")) {continue} else if(userGroup == ugName) {continue} err = unset(I, ugName) if (!null err){errorBox(err)} } } SetModAccess(I, read, null) // Everyone else (R). } int i //Loop through the module list. for (i = noElems (userListView); i >= 0; i--) { //If the item is selected then remove it from list to process. if (selected (userListView, i)) { string DBuser = get (userListView, i) string userGroup = null if (find(DBuserList,Uname,userGroup) || Uname == "Administrator") { if(userGroup == "Engineering Lead" || Uname == "Administrator" || get(optionTestSpec)) { if(DBuser == Uname) { // Set UserGroup/User SetModAccess(I, control, DBuser) // (RMCA). err = setImplied(I, delete) // Propagate access rights (MD). if (!null err){errorBox(fullName(I) "\n" err)} } else { // Set UserGroup/User SetModAccess(I, read|create|modify, DBuser) // (RC). err = setImplied(I, delete) // Propagate access rights (MD). if (!null err){errorBox(fullName(I) "\n" err)} } } else if(userGroup == "IV&V Lead") { if(DBuser == Uname) { // Set UserGroup/User SetModAccess(I, control, DBuser) // (RMCA). err = setImplied(I, null) // Turn off Propagate access rights. if (!null err){errorBox(fullName(I) "\n" err)} } else { // Set UserGroup/User SetModAccess(I, read|modify, DBuser) // (RM). err = setImplied(I, null) // Turn off Propagate access rights. if (!null err){errorBox(fullName(I) "\n" err)} } } } } } Module m = edit(fullName(I), false, true) if(!null m) { Reset(m) save(m) close(m) }else{errorBox("{Null} "fullName(I)"!")} } infoBox ("Done!") }else {warningBox("No User(s) selected!")} }else {warningBox("No module(s) selected to process!")} }//End applyAccess /********************************** applyAccess ***********************************/ void applyAccess (DB win) { if(get(optionIndividualUser)) { applyUser(win) } else { applyUserGroup(win) } if(!null message) { string fromDescription = null Skip targetAddresses = create Skip ccAddresses = create; ccAddresses = null Skip bccAddresses = create; bccAddresses = null string subject = null Group LG = find("Engineering Lead") if ((getCheck (accessListView, 0) && getCheck (accessListView, 1) && !getCheck (accessListView, 2) && !getCheck (accessListView, 3) && !getCheck (accessListView, 4) && !getCheck (accessListView, 5)) || (getCheck (accessListView, 0) && !getCheck (accessListView, 1) && getCheck (accessListView, 2) && !getCheck (accessListView, 3) && !getCheck (accessListView, 4) && !getCheck (accessListView, 5)) || (!getCheck (accessListView, 1) && !getCheck (accessListView, 2))) { if (Uname == "Administrator") { targetAddresses = IVVEmailList ccAddresses = EngEmailList subject = "Administrator has transfered to Read-only!" } else if(member(LG, u)) { targetAddresses = IVVEmailList ccAddresses = EngEmailList subject = "Engineering(" Uname ") has transfered to Read-only!" } else { targetAddresses = EngEmailList ccAddresses = IVVEmailList subject = "IV&V(" Uname ") has transfered to Read-only!" } sendEMailMessage(fromDescription, targetAddresses, ccAddresses, bccAddresses, subject, stringOf(message)) } else if(((member(LG, u) || Uname == "Administrator") && getCheck (accessListView, 2)) || ((!member(LG, u) || Uname == "Administrator") && getCheck (accessListView, 1))) { if (Uname == "Administrator") { if(getCheck (accessListView, 1) && !getCheck (accessListView, 2)) { targetAddresses = EngEmailList ccAddresses = IVVEmailList subject = "Administrator has changed Engineering access!" } else{ targetAddresses = IVVEmailList ccAddresses = EngEmailList subject = "Administrator has changed IV&V access!" } } else if(member(LG, u)) { targetAddresses = IVVEmailList ccAddresses = EngEmailList subject = "Engineering(" Uname ") has transfered access to IV&V!" } else { targetAddresses = EngEmailList ccAddresses = IVVEmailList subject = "IV&V(" Uname ") has transfered access to Engineering!" } sendEMailMessage(fromDescription, targetAddresses, ccAddresses, bccAddresses, subject, stringOf(message)) } delete targetAddresses delete ccAddresses delete bccAddresses } freeResources() destroy(db) db = null }//End applyAccess /********************************** closedb ***********************************/ void closedb (DB win) { freeResources() destroy(db) db = null }//End closedb /********************************** resetshareable ***********************************/ void resetshareable (DB win) { if (itemsSelected()) { Item I //Set the reset shareable-edit on the selected items. for I in items do { Module m = edit(fullName(I), false, true) if(!null m) { Reset(m) save(m) close(m) }else{errorBox("{Null} Module Parameter!")} } infoBox("Done!") freeResources() destroy(db) db = null } //Warning user that no items are selected! else {warningBox("No module(s) selected to process!")} }//End resetshareable. /********************************** accessCallback ***********************************/ void accessCallback (DBE win, int check) { // None [0] // Engineering Lead [1] // IV&V Lead [2] // Application Engineer [3] // Hardware Engineer [4] // IV&V Engineer [5] //None is selected. if (check == 0 && getCheck (win, check)) { //Future Code... } else if (check == 0 && !getCheck (win, check)) { setCheck (win, 1, false) setCheck (win, 2, false) setCheck (win, 3, false) setCheck (win, 4, false) setCheck (win, 5, false) } //Engineering Lead is selected. else if (check == 1 && getCheck (win, check)) { if(!get(optionTestSpec)) { setCheck (win, 0, true) setCheck (win, 2, false) } else { setCheck (win, 1, false) warningBox("Not allowed!") } } else if (check == 1 && !getCheck (win, check)) { setCheck (win, 3, false) setCheck (win, 4, false) } //IV&V Lead is selected. else if (check == 2 && getCheck (win, check)) { setCheck (win, 0, true) setCheck (win, 1, false) setCheck (win, 3, false) setCheck (win, 4, false) } else if (check == 2 && !getCheck (win, check)) { setCheck (win, 5, false) } //Applicantion Engineer is selected. else if (check == 3 && getCheck (win, check)) { if(!get(optionTestSpec)) { setCheck (win, 0, true) setCheck (win, 1, true) setCheck (win, 2, false) } else { setCheck (win, 3, false) warningBox("Not allowed!") } } //Hardware Engineer is selected. else if (check == 4 && getCheck (win, check)) { if(!get(optionTestSpec)) { setCheck (win, 0, true) setCheck (win, 1, true) setCheck (win, 2, false) } else { setCheck (win, 4, false) warningBox("Not allowed!") } } //IV&V Engineer is selected. else if (check == 5 && getCheck (win, check)) { setCheck (win, 0, true) setCheck (win, 2, true) setCheck (win, 1, false) setCheck (win, 3, false) setCheck (win, 4, false) } }//End accessCallback. /********************************** addItemToList ***********************************/ void addItemToList (Item I) { int count = 0 int i = 0 int rowNum = 0 bool itemExists = false int listnum = noElems (moduleList) if (type (I) == "Formal") { if ((TestSpec fullName(I)) && !get(optionTestSpec)) { warningBox("Cannot modify Test Spec. {" name(I) "}\nPlease see the Administrator!") } else if(!canControl (I)) { errorBox("Cannot switch access {" name(I) "}") } else { //Check the item isn't all ready in the list. for (i = 0; i < listnum && !itemExists; i++) { if (fullName(I) == (get (moduleList, i))) { itemExists = true break } } //If not in the list all ready. if (!itemExists) { //Add the formal module. string ugName = null LockList lList Lock lck ModName_ modRef = module (fullName (I)) //Get the locks on the module if any. lList = getLocksInModule (modRef, true) for lck in lList do { count++ ugName = lck.user } if(count>1){ugName = ugName "{+}"} //Insert the module in the list with with normal icon if not locked. if (!isLocked (modRef) || (isLocked (modRef) && ugName == null)) { insert (moduleList, rowNum, fullName (I), iconFormal) set (moduleList, rowNum, 1, ugName) put (items, I, I) } //Insert the item in the list with the deleted icon indicating it is locked //and will not be processed. else { Icon ic = addr_ 174 insert (moduleList, rowNum, fullName (I), ic) set (moduleList, rowNum, 1, ugName) } rowNum++ //delete(lList) get memory error when deleting lList! } } } }//End addItemToList. /********************************** listViewSelect ***********************************/ void listViewSelect (DBE win, int i) { //Do nothing. }//End listViewSelect. /********************************** listViewDeselect ***********************************/ void listViewDeselect (DBE win, int i) { //Do nothing. }//End listViewDeselect. /********************************** treeSelect ***********************************/ void treeSelect (DBE win) { //Do nothing. }//End treeSelect /********************************** listActivate ***********************************/ void listActivate (DBE win, int i) { //Delete the item from the list. delete (itemList, i) numItems-- }//End listActivate. /********************************** treeActivate ***********************************/ void treeActivate (DBE win) { Buffer temp = create (1) bool itemSelected = false int listnum = noElems (moduleList) int i = 0 Item I temp += "/" get (win) I = item (tempStringOf (temp)) //Make sure the item hasn't been selected all ready. for (i = 0; i < numItems && !itemSelected; i++) { if (tempStringOf (temp) == (get (itemList, i))) { itemSelected = true break } } if(!itemSelected) { for (i = 0; i < listnum && !itemSelected; i++) { if (tempStringOf (temp) == (get (moduleList, i))) { itemSelected = true break } } } string txt3 = fullName(I) if (!itemSelected) { if(type (I) == "Formal") { if (TestSpec fullName(I) && !get(optionTestSpec)) { warningBox("Cannot modify Test Spec.\nPlease see the Administrator!") } else if(!(TestSpec fullName(I)) && get(optionTestSpec)) { warningBox("Cannot modify Non-Test Spec.\nPlease see the Administrator!") } else { if(canControl(I) && RecordControl(I)) { //Enter the module in the items list. insert (itemList, numItems, tempStringOf (temp), iconFormal) numItems ++ } else { errorBox("Cannot switch access {" name(I) "}") } } } } else { //Let the user know the module was all ready selected. warningBox("Item has all ready been selected.") } delete (temp) }//End treeActivate. /********************************** addItemsCallback ***********************************/ void addItemsCallback (DB win) { Item I //Loop through the items in the list and add them to the selected items on the main DB. for (i = 0; i < numItems; i++) { I = item (get (itemList, i)) addItemToList (I) } }//End addItemsCallback. /********************************** addItemToList ***********************************/ void addItemToList (DB win) { string listViewItems [] //Create the Add Items dialog box. DB addItems = create ("Add Items", styleCentered|styleStandard|styleFloating) Project p Item I //Set the number of items to 0. numItems = 0 //Create the dialog box elements. treeFrame = frame (addItems, "Select Items:", 350, 250) listFrame = frame (addItems, "Selected Items:", 500, 250) itemTree = treeView (addItems, treeViewOptionSorted, 250, 10) itemList = listView (addItems, 0, 35, 15, listViewItems) set (itemTree, treeSelect, treeActivate) set (itemList, listViewSelect, listViewDeselect, listActivate) //Position the dialog box elements. treeFrame->"right"->"unattached" treeFrame->"bottom"->"form" listFrame->"top"->"aligned"->treeFrame listFrame->"right"->"form" listFrame->"left"->"spaced"->treeFrame listFrame->"bottom"->"form" itemTree->"top"->"inside"->treeFrame itemTree->"left"->"inside"->treeFrame itemTree->"right"->"inside"->treeFrame itemTree->"bottom"->"inside"->treeFrame itemList->"top"->"inside"->listFrame itemList->"left"->"inside"->listFrame itemList->"right"->"inside"->listFrame itemList->"bottom"->"inside"->listFrame //Add the OK Button. ok (addItems, "Add Items", addItemsCallback) //Show the DB. realize (addItems) //Insert a column in the itemList listView. insertColumn (itemList, 0, "Items", 480, iconNone) //Loop through all the items in the database by project and //insert them into the treeView. for p in database do { insert (itemTree, fullName (p), iconProject, iconProjectOpen) for I in p do { if (getParentProject(I) != p) {continue} // Ignore items is nested Projects if (isDeleted(I) || null I) {continue} if (type (I) == "Folder") { insert (itemTree, fullName (I), iconFolder, iconFolderOpen) } else if (type (I) == "Formal") { if(canControl(I) && RecordControl(I)) { if(Uname == "Administrator" && ReadOnly(I)) { Icon ic = addr_ 33 insert (itemTree, fullName (I), ic, ic) } else { Icon ic = addr_ 52 insert (itemTree, fullName (I), ic, ic) } } else { if(ReadOnly(I)) { Icon ic = addr_ 33 insert (itemTree, fullName (I), ic, ic) } else { Icon ic = addr_ 35 insert (itemTree, fullName (I), ic, ic) } } } } } }//End addItemToList. /********************************** removeItemFromList ***********************************/ void removeItemFromList (DB win) { int i = 0 bool msg = true //Loop through the module list. for (i = noElems (moduleList); i >= 0; i--) { //If the item is selected then remove it from list to process. if (selected (moduleList, i)) { delete (items, item get (moduleList, i)) delete (moduleList, i) msg = false } } if(msg){warningBox "No item(s) selected!"} }//End removeItemFromList. /********************************** createDB ***********************************/ void createDB () { User uX bool ugDisabled string temp [] string access [6] = {"None", "Engineering Lead", "IV&V Lead", "Application Engineer", "Hardware Engineer", "IV&V Engineer"} string ugName int userNum = 0 Item I if(!validation()) { freeResources() halt } //Start building the dialog box. db = create ("Grant/Remove Access", styleStandard|styleCentered) moduleList = listView (db, listViewOptionMultiselect, 495, 15, temp) optionIndividualUser = toggle(db,"Indvidual User(s)",false) beside(db) optionAppendUsers = toggle(db,"Append User(s)",false) beside(db) optionTestSpec = toggle(db,"Test Specs",false) accessListView = listView (db, listViewOptionCheckboxes, 155, 9, access) userListView = listView (db, listViewOptionMultiselect, 225, 8, temp) apply (db, "Add Item(s)", addItemToList) apply (db, "Remove Item(s)", removeItemFromList) apply (db, "Reset Shareable", resetshareable) apply (db, "Turn Off Shareable", TurnOffShareable) apply (db, "Apply", applyAccess) close (db, true, closedb) //Placement of the DBE's on the dialog box. accessListView->"right"->"unattached" accessListView->"bottom"->"form" userListView->"top"->"aligned"->accessListView userListView->"left"->"spaced"->accessListView realize (db) //Put the appropriate columns in the list views. insertColumn (userListView, 0, "Username", 200, iconNone) insertColumn (userListView, 1, "User", 100, iconNone) insertColumn (accessListView, 0, "Access", 150, iconNone) insertColumn (moduleList, 0, "Selected Items", 400, iconNone) insertColumn (moduleList, 1, "Locked By", 90, iconNone) //Engineering Group EG = find("Engineering Lead") Group AE = find("Application Engineer") Group HE = find("Hardware Engineer") //IV&V Group IL = find("IV&V Lead") Group IE = find("IV&V Engineer") //Add the users to the user list view. for uX in userList do { ugDisabled = uX.disabled if(ugDisabled) {continue} if(member(IL, u)) //IV&V Lead { if((member(IL, uX) || member(IE, uX)) && (!member(EG, uX) && !member(AE, uX) && !member(HE, uX))) { ugName = uX.name insert (userListView, userNum, ugName, iconUser) ugName = uX.fullName set (userListView, userNum, 1, ugName) userNum++ } } else { if((member(EG, uX) || member(AE, uX) || member(HE, uX)) && (!member(IL, uX) && !member(IE, uX))) { ugName = uX.name insert (userListView, userNum, ugName, iconUser) ugName = uX.fullName set (userListView, userNum, 1, ugName) userNum++ } } } // Refresh permissions. refreshDBExplorer() //Get the selected items and add them to the module list view. for I in selectedItems do { if(isDeleted(I) || null I) {continue} if(TestSpec fullName(I) && !get(optionTestSpec)) { set(optionTestSpec,true) } addItemToList (I) } inactive(userListView) inactive(optionAppendUsers) string userGroup = null find(DBuserList,Uname,userGroup) if (userGroup == "IV&V Lead" || Uname == "Administrator") { active(optionTestSpec) } else { inactive(optionTestSpec) hide(optionTestSpec) } //Set the sort on the list views. set (userListView, 0, sortListView) set (userListView, 1, sortListView) //Set the callback for the access list view. set (accessListView, accessCallback) set (optionIndividualUser, optionCallback) set (optionTestSpec, optionTestSpecCallback) //Warning user that no items are selected! if(!itemsSelected()){warningBox("No module(s) selected to process!")} //Show the dialog box. show (db) }//End createDB. //Call function. createDB ()DB.