Highlighted
Micro Focus Expert
Micro Focus Expert
137 views

Using the StarTeam SDK to mark views read only.

The sample program below will allow you to mark all child views of a project read-only for all users (except administrators)

 

             Server s = new Server("localhost", 49201);

             s.logOn("Administrator", "Administrator");

             Project p = s.findProject("testproject");

             View[] vv = p.getViews();

             ACE a1 = new ACE(s.getAdministratorsGroup(), new PermissionCollection(Permission.ALL_PERMISSIONS), true /* granted */);

             ACE a2 = new ACE(s.getAllUsersGroup(), new PermissionCollection(Permission.GENERIC_SEE_OBJECT), true /* granted */);

             ACE a3 = new ACE(s.getAllUsersGroup(), new PermissionCollection(Permission.ALL_PERMISSIONS), false /* denied */);

             ACE[] aces = new ACE[] {a1, a2, a3};

             for (int i = 0; i < vv.length; i++) {

                    View v = vv;

                    v.setRights(aces);

                    // set the new rights on each view

                    // administrators continue to enjoy full rights

                    // all other users have read only rights.

             }

             s.disconnect();

Please note that this can easily be extended to set container access rights on types as well. But the basic idea here is to be able to quickly execute a snippet of code, rather than go through a series of repetitive UI actions that will ultimately achieve the same thing.

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.