Hello, |
Re: DOORS Item parent and level -using DXL Here is a script that will iterate through all projects in the database. int lev = 1 Project p Stream tem = write "C:\\Temp\\AllWithLevels.txt" void processItem(Item i) { tem << name i tem << "\t" tem << "level " tem << lev "" tem << "\n" if (type i == "Project" || type i == "Folder") { lev++ Item j for j in folder fullName i do { if (type j == "Project") continue processItem j } lev-- } } for p in database do { processItem item fullName p } close tem
|
Re: DOORS Item parent and level -using DXL johnzweck - Thu May 13 11:52:40 EDT 2010 Here is a script that will iterate through all projects in the database. int lev = 1 Project p Stream tem = write "C:\\Temp\\AllWithLevels.txt" void processItem(Item i) { tem << name i tem << "\t" tem << "level " tem << lev "" tem << "\n" if (type i == "Project" || type i == "Folder") { lev++ Item j for j in folder fullName i do { if (type j == "Project") continue processItem j } lev-- } } for p in database do { processItem item fullName p } close tem
Thanks for your help. Now i can able to get levels. with Levels, i need to get parent too. So, can you please suggest me how can get the parent for all items? Looking forward your reply. Thanks in advance, Muthurani M |
Re: DOORS Item parent and level -using DXL
There are two perms that you may find interesting: int GetItemLevel(Item itm) { // The level is how far down the hierarchy this item is from the parent Project if (null itm) return(-1) Project pParent = getParentProject(itm) if (null pParent) return(-1) int Depth = 1 Folder fProj = folder(pParent) Folder fCurr = getParentFolder(itm) if (null fCurr) return(-1) while(!null fCurr and fProj != fCurr) { Depth++ fCurr = getParentFolder(fCurr) } return(Depth) } // end GetItemLevel()
|
Re: DOORS Item parent and level -using DXL johnzweck - Thu May 13 11:52:40 EDT 2010 Here is a script that will iterate through all projects in the database. int lev = 1 Project p Stream tem = write "C:\\Temp\\AllWithLevels.txt" void processItem(Item i) { tem << name i tem << "\t" tem << "level " tem << lev "" tem << "\n" if (type i == "Project" || type i == "Folder") { lev++ Item j for j in folder fullName i do { if (type j == "Project") continue processItem j } lev-- } } for p in database do { processItem item fullName p } close tem
I have looked at the script which you have posted where it will dispay all the projects,folders and modules and there levels in a text file. I have one question on this like is it possible to get the access rights for under a project tree(Project,Folder,Modules)? Generally i want to generate a report where it will display the access rights for all the Projects,Folders and Modules in a DOORS database. If yes can you please share a dxl script with me. Kindly revert back to me for any further details. Please let me know if this is possible. Thanks in advance Regards, Shruthi |
Re: DOORS Item parent and level -using DXL Bosch - Tue Jun 14 08:18:02 EDT 2011 This script could be modified to redirect the report to an external TXT file if that is important, probably quicker to just copy an paste the contents of the pop up TXT window. Credit for this script goes to Telelogic (Kev Bostic - where is he now?) - on oldy but a goody, it's circa DOORS version 5.1 and still works. Paul Miller Melbourne, Australia Attachments attachment_14627903_TelelogicUG_DBAccessRights.dxl |
Re: DOORS Item parent and level -using DXL SystemAdmin - Tue Jun 14 20:37:02 EDT 2011 Paul Miller Melbourne, Australia Regards, Shruthi |
Re: DOORS Item parent and level -using DXL Bosch - Wed Jun 15 00:14:57 EDT 2011 My main requirement is generating a report for the access rights according to the below points 1. The project should not contain the other project groups,if it contain other groups then it should print what all other groups are present 2. should print what are all the project groups currently the Project/Folder/Module is containing 3. should print what are all the project groups not containing. Project name is "Hello" Groups for Project "Hello": 1. AI_Hello_RM 2. AI_Hello_PM 3. AI_Hello_Viewer I have Project under that the Folder and under folder one module So the Project hierarchy is Project->Folder->Module Each item has different access rights. Project Access rights: 1.AI_Hello_RM 2.AI_Test_RM 3.Everyone else Folder Access rights: 1.AI_Hello_RM 2.AI_Hello_PM 3.AI_Test_PM 4.Everyone else Module Access rights: 1.AI_Hello_RM 2.AI_Hello_Viewer 3.AI_Test_Viewer 4.Everyone else So currently the Project/Folder/Module is not containing all the Project groups ie. hello and its also containing the other project groups also. So i want to partition each and everything separately like as mentioned above. Kindly help me out and reply me if its possible. Thank you! Regards, Shruthi |
Re: DOORS Item parent and level -using DXL SystemAdmin - Tue Jun 14 20:37:02 EDT 2011 Paul Miller Melbourne, Australia My main requirement is generating a report for the access rights according to the below points 1. The project should not contain the other project groups,if it contain other groups then it should print what all other groups are present 2. should print what are all the project groups currently the Project/Folder/Module is containing 3. should print what are all the project groups not containing. Project name is "Hello" Groups for Project "Hello": 1. AI_Hello_RM 2. AI_Hello_PM 3. AI_Hello_Viewer I have Project under that the Folder and under folder one module So the Project hierarchy is Project->Folder->Module Each item has different access rights. Project Access rights: 1.AI_Hello_RM 2.AI_Test_RM 3.Everyone else Folder Access rights: 1.AI_Hello_RM 2.AI_Hello_PM 3.AI_Test_PM 4.Everyone else Module Access rights: 1.AI_Hello_RM 2.AI_Hello_Viewer 3.AI_Test_Viewer 4.Everyone else So currently the Project/Folder/Module is not containing all the Project groups ie. hello and its also containing the other project groups also. So i want to partition each and everything separately like as mentioned above. Kindly help me out and reply me if its possible. Thank you! Regards, Shruthi |
Re: DOORS Item parent and level -using DXL Bosch - Fri Jul 15 09:09:59 EDT 2011 I presume that given Project name "Hello" that all that project's user Groups should start with "AI_Hello_". Perhaps this: // FindForeignGroups.dxl /* For folders and module here and below, print their access records also find Project groups that lack any access, and find non-project groups that do */ Buffer gl_psnConversion_Results = create(8) // Local buffer to the following functions. //******************************** string fStringOf(AccessRec ar) { // Get the string Permissions associated with the AccessRec; // e.g, 'RMCDA' or 'RM' if (null ar) return("") gl_psnConversion_Results = "" if (read(ar)) gl_psnConversion_Results += "R" if (modify(ar)) gl_psnConversion_Results += "M" if (create(ar)) gl_psnConversion_Results += "C" if (delete(ar)) gl_psnConversion_Results += "D" if (control(ar)) gl_psnConversion_Results += "A" if (length(gl_psnConversion_Results) == 0) gl_psnConversion_Results = "None" return(stringOf(gl_psnConversion_Results)) } // end fStringOf(ar) //******************************* bool IsPrefix(string Name, Prefix) { // Does the Name start with the Prefix? return(length(Name) > length(Prefix) and Name[0:length(Prefix)-1] == Prefix) } // end IsPrefix() //******************************* Skip skpGetProjectGroups(string Prefix) { // Get list of all user Groups that start with the Prefix // Calling program should delete the Skip when finished Skip skpNames = createString() // returned skip, KEY and DATA both 'string' name string NameGroup Group grp for grp in groupList do { NameGroup = grp.name if (IsPrefix(NameGroup, Prefix)) put(skpNames, NameGroup, NameGroup) } return(skpNames) } // end skpGetProjectGroups() Skip skpProjectGroups = null //************************************************************* void PrintItem(Item itm) { AccessRec ar bool IsInherit string NameAR, NameGroup Skip skpGroupsUsed = createString // KEY and DATA both 'string' Group name with any access print name(itm) " \t" type(itm) "...\n" for ar in all itm do { isAccessInherited(itm, IsInherit) if (IsInherit) // then print "\tInherited\t" else print "\tSpecific \t" NameAR = username(ar) if (isDefault(ar)) // then print "Everyone else\t" fStringOf(ar) "\t" else { print (NameAR)" \t" fStringOf(ar) "\t" if (existsGroup(NameAR)) { if (!find(skpProjectGroups, NameAR)) print "** External Group used" put(skpGroupsUsed, NameAR, NameAR) } else print "User" } print "\n" } for NameGroup in skpProjectGroups do { if (!find(skpGroupsUsed, NameGroup)) print "\t\t" NameGroup "\t\t**Internal Group not used\n" } delete(skpGroupsUsed) } // end PrintItem() //************************************************************* void RecurseFolder(Folder fld) { if (null fld) return Item itm = item(fullName(fld)) Skip skpItems = createString() Folder fldNew PrintItem(itm) // This folder's Access for itm in fld do { put(skpItems, name(itm), itm) } for itm in skpItems do { if (type(itm) != "Formal" and type(itm) != "Link" and type(itm) != "Descriptive") continue PrintItem(itm) // Module's access } for itm in skpItems do { if (type(itm) != "Folder" and type(itm) != "Proejct") continue fldNew = folder(itm) RecurseFolder(fldNew) // Recurse sub-folders } delete(skpItems) } // ======== MAIN ========= string NameProj = "Hello" string NamePrefix = "AI_" NameProj "_" //NamePrefix = "LPD26-" // Landale testing skpProjectGroups = skpGetProjectGroups(NamePrefix) RecurseFolder(current Folder)
|
Re: DOORS Item parent and level -using DXL llandale - Fri Jul 15 13:06:22 EDT 2011 I presume that given Project name "Hello" that all that project's user Groups should start with "AI_Hello_". Perhaps this: // FindForeignGroups.dxl /* For folders and module here and below, print their access records also find Project groups that lack any access, and find non-project groups that do */ Buffer gl_psnConversion_Results = create(8) // Local buffer to the following functions. //******************************** string fStringOf(AccessRec ar) { // Get the string Permissions associated with the AccessRec; // e.g, 'RMCDA' or 'RM' if (null ar) return("") gl_psnConversion_Results = "" if (read(ar)) gl_psnConversion_Results += "R" if (modify(ar)) gl_psnConversion_Results += "M" if (create(ar)) gl_psnConversion_Results += "C" if (delete(ar)) gl_psnConversion_Results += "D" if (control(ar)) gl_psnConversion_Results += "A" if (length(gl_psnConversion_Results) == 0) gl_psnConversion_Results = "None" return(stringOf(gl_psnConversion_Results)) } // end fStringOf(ar) //******************************* bool IsPrefix(string Name, Prefix) { // Does the Name start with the Prefix? return(length(Name) > length(Prefix) and Name[0:length(Prefix)-1] == Prefix) } // end IsPrefix() //******************************* Skip skpGetProjectGroups(string Prefix) { // Get list of all user Groups that start with the Prefix // Calling program should delete the Skip when finished Skip skpNames = createString() // returned skip, KEY and DATA both 'string' name string NameGroup Group grp for grp in groupList do { NameGroup = grp.name if (IsPrefix(NameGroup, Prefix)) put(skpNames, NameGroup, NameGroup) } return(skpNames) } // end skpGetProjectGroups() Skip skpProjectGroups = null //************************************************************* void PrintItem(Item itm) { AccessRec ar bool IsInherit string NameAR, NameGroup Skip skpGroupsUsed = createString // KEY and DATA both 'string' Group name with any access print name(itm) " \t" type(itm) "...\n" for ar in all itm do { isAccessInherited(itm, IsInherit) if (IsInherit) // then print "\tInherited\t" else print "\tSpecific \t" NameAR = username(ar) if (isDefault(ar)) // then print "Everyone else\t" fStringOf(ar) "\t" else { print (NameAR)" \t" fStringOf(ar) "\t" if (existsGroup(NameAR)) { if (!find(skpProjectGroups, NameAR)) print "** External Group used" put(skpGroupsUsed, NameAR, NameAR) } else print "User" } print "\n" } for NameGroup in skpProjectGroups do { if (!find(skpGroupsUsed, NameGroup)) print "\t\t" NameGroup "\t\t**Internal Group not used\n" } delete(skpGroupsUsed) } // end PrintItem() //************************************************************* void RecurseFolder(Folder fld) { if (null fld) return Item itm = item(fullName(fld)) Skip skpItems = createString() Folder fldNew PrintItem(itm) // This folder's Access for itm in fld do { put(skpItems, name(itm), itm) } for itm in skpItems do { if (type(itm) != "Formal" and type(itm) != "Link" and type(itm) != "Descriptive") continue PrintItem(itm) // Module's access } for itm in skpItems do { if (type(itm) != "Folder" and type(itm) != "Proejct") continue fldNew = folder(itm) RecurseFolder(fldNew) // Recurse sub-folders } delete(skpItems) } // ======== MAIN ========= string NameProj = "Hello" string NamePrefix = "AI_" NameProj "_" //NamePrefix = "LPD26-" // Landale testing skpProjectGroups = skpGetProjectGroups(NamePrefix) RecurseFolder(current Folder)
This is what i needed. Thank you! Regards, Shruthi |