Highlighted
Super Contributor.
Super Contributor.
304 views

Requirement Folder creation restriction - need input

Jump to solution

Intention of this implementation is to restrict other than TDAdmin or Defect Manager to post new requirement.

This logic is working correctly. But with a side effect as below:

1. Even if other users are dragging 1 req folder to another req folder, Workflow is restricting user

2. Even if other users are renaming 1 req folder to another req folder, Workflow is restricting user

Can you please let me know what condition I should include in the logic so that users will only be restricted for creating new folders and they can drag or rename folders.

This has a bit of urgency as I need to know the issue and need to implement not only for Requirement module, but also for Test Plan and Lab.

All are currently having same issue.

Req_Canpost

 

'=======================================================----------------------------------

if Req_Fields("RQ_TYPE_ID").Value = "Folder"

   If User.IsInGroup("TDAdmin") or User.IsInGroup("Defect Manager") Then

'MsgBox "User " & User.FullName & _

'        " has permission to create new Req Folders. Req folder Created!"

          Req_CanPost = True

 Else

 

  MsgBox "User: " & User.FullName & _

        " does not have permission to create new Req Folders. Defect Managers can create new Folders." & vbNewLine & "Email 'abc@abc.com' in case of any issue.",  vbCritical

  Req_CanPost = False

End If

 End If

'=======================================================----------------------------------

Can anyone help?

Thanks & Regards,

Priyotosh

0 Likes
1 Solution

Accepted Solutions
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: Requirement Folder creation restriction - need input

Jump to solution

I suggest you remove your code from Req_CanPost.

Then add this to ActionCanExecute:

If ActionName =  "Requirements.NewFolder" 
   If User.IsInGroup("TDAdmin") = False AND User.IsInGroup("Defect Manager") = False Then
    ActionCanExecute = False
    Exit Function
   End If
End If
 

 

And in Req_FieldCanChange:

If FieldName = "RQ_TYPE_ID" AND NewValue = "Folder" Then
   If User.IsInGroup("TDAdmin") = False AND User.IsInGroup("Defect Manager") = False Then
       Req_FieldCanChange = False
       Exit Function
   End If
End If

 

Jan Czajkowski

[Please do not contact me off line for receiving support. Use the forum!]

View solution in original post

0 Likes
7 Replies
Highlighted
Super Contributor.
Super Contributor.

Re: Requirement Folder creation restriction - need input

Jump to solution

Not requirement, but Requirement folder.

0 Likes
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: Requirement Folder creation restriction - need input

Jump to solution

I suggest you remove your code from Req_CanPost.

Then add this to ActionCanExecute:

If ActionName =  "Requirements.NewFolder" 
   If User.IsInGroup("TDAdmin") = False AND User.IsInGroup("Defect Manager") = False Then
    ActionCanExecute = False
    Exit Function
   End If
End If
 

 

And in Req_FieldCanChange:

If FieldName = "RQ_TYPE_ID" AND NewValue = "Folder" Then
   If User.IsInGroup("TDAdmin") = False AND User.IsInGroup("Defect Manager") = False Then
       Req_FieldCanChange = False
       Exit Function
   End If
End If

 

Jan Czajkowski

[Please do not contact me off line for receiving support. Use the forum!]

View solution in original post

0 Likes
Highlighted
Super Contributor.
Super Contributor.

Re: Requirement Folder creation restriction - need input

Jump to solution

@Jan Czajkowski Thanks a lot for your input. This logic works for Requirement module.

For Test Lab module, however, the logic is a bit different.

Here I need to identify the level of Test Set Folder that User is trying to create and if the level is more than 2 depth (like: Root\Base_Folder\Leaf_Folder\New Folder Name), then it will allow, otherwise not.

I am capturing the root folder by below code:

1. Declared Parent_Test_Set_Folder  as global variable

2.  Code in TestSetFolder_MoveTo

Set Parent_Test_Set_Folder = TDConnection.TestLabFolderFactory.Item(TestSetFolder_Fields.Field("CF_FATHER_ID").Value)

3. within ActionCanExecute

if ActionName = "TestLab.NewFolder" then

if User.IsInGroup("TDAdmin") or User.IsInGroup("BHF Defect Manager") Then

ActionCanExecute = True
else

If Len("\") Then
CharacterCount = UBound(Split(Parent_Test_Set_Folder.Path, "\"))
End If

If Cint(CharacterCount) <= 2 then

ActionCanExecute = False

Else 

ActionCanExecute = True

End If

But it seems ActioncanExecute is not communicating to global variable and complaining Item not exist for below line

CharacterCount = UBound(Split(Parent_Test_Set_Folder.Path, "\"))

 

Can you please help.

0 Likes
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: Requirement Folder creation restriction - need input

Jump to solution
You need to declare your global variable in Common workflow.
Jan Czajkowski

[Please do not contact me off line for receiving support. Use the forum!]
0 Likes
Highlighted
Super Contributor.
Super Contributor.

Re: Requirement Folder creation restriction - need input

Jump to solution

@Jan Czajkowski I declared in common module only.

When user is selecting root and trying to create a new Test Set folder, workflow is showing stated error message but other than that it is capturing.

0 Likes
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: Requirement Folder creation restriction - need input

Jump to solution
It is not clear to me from what you write when you get the error and what is the exact error message.
One general tip is that when setting ActionCanExecute = False, always do an Exit Function - otherwise the function will be allowed to execute in any case.

The approach I would use to check that folder depth is enough would be to get the father ID of current folder, then father ID of father folder. If not equal to Root ID, allow folder creation.
Jan Czajkowski

[Please do not contact me off line for receiving support. Use the forum!]
0 Likes
Highlighted
Super Contributor.
Super Contributor.

Re: Requirement Folder creation restriction - need input

Jump to solution

thank you very much @Jan Czajkowski for the insight.

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.