Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

Restricting access for adding file/folder in a particular level of directories under components & Streams

Hi Ralph,

Please help on the requirement.

I need to avoid user to add file/folder into second level of component under Streams.

Example:

  • Project-Area
    • Source Control
      • Stream 1
      • Stream 2
      • Stream 3
        • Component 1
        • Component 2
        • Component 3
          • Folder 1
            • File 1
            • File 2
          • Folder 2
            • File 1
            • File 2

I want to restrict user not to add file/folder under components, but they should have rights to add file / folder into next level.

Shall i do this using IVersionHandle or IAncestorReport?

Thanks !!!

Sudar

0 votes


Accepted answer

Permanent link
I think you should use both, and others as well:
IVersionHandle versionableH = ...
IWorkspaceHandle wksH = ...
IComponentHandle componentH = ...
ServiceConfigurationProvider configProvider = ServiceConfigurationProvider.FACTORY.create(wksH, componentH);
IAncestorReport[] reports = scmService.configurationLocateAncestors(configProvider, new IVersionableHandle[]{ versionableH }, null, IRepositoryProgressMonitor.ITEM_FACTORY.createItem(monitor));
List<INameItemPair> segments = reports[0].getNameItemPairs();
if (segments.size() != 3) { // segments[0] is for root folder and always null.
throw new TeamRepositoryException("You can only add files in to 2nd level folders");
}
Cheers.
Sudaraazhi Arivalagan selected this answer as the correct answer

2 votes

Comments

 Instead of throwing an exception you should probably create a IAdvisorInfo:


IAdvisorInfo problem = collector.createProblemInfo( "You can only add files in to 2nd level folders","You can only add files in to 2nd level folders","advisor.reject");
collector.addInfo(problem);

Sure you can, though it depends on where that snippet will be used.

Of-course... I should have noted that if the snippet was to be used in an advisor then createProblemInfo would be advisable :-)

Thank you Servizi !!!

Thank you Martin !!


One other answer

Permanent link
 Is this question a duplicate of https://jazz.net/forum/questions/165423/controlling-addition-of-files-in-the-second-level-directory-of-rtc-components ? 

Just answered that one again.

0 votes

Comments

Yes Martin, I just wanted to describe my requirement in different manner.

Thank you !!

Your answer

Register or log in to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 25

Question asked: Oct 14 '14, 5:31 a.m.

Question was seen: 6,227 times

Last updated: Oct 16 '14, 8:24 a.m.

Confirmation Cancel Confirm