1
我正嘗試將權限授予Perforce中某個文件夾上的組。但是,在Perforce中從Java創建/更新的權限表是空的。通過java追加perforce權限表導致空白權限表
以下是我做的步驟 -
//Get the server object.
IOptionsServer server = ServerFactory.getOptionsServer("p4java://<ip>:1666", null);
server.connect();
server.setUserName("<username>"); // this is a super user
server.login("<password>");
//Create a user group and add users.
IUserGroup ug = new UserGroup();
String groupName = "<usergroup_somename>;
ug.setName(groupName);
List<String> userList = new ArrayList<>();
userList.add("<username1>");
userList.add("<username2>");
userList.add("<username3>");
ug.setUsers(userList);
server.createUserGroup(ug);
//Get the permission table.
GetProtectionEntriesOptions gpo = new GetProtectionEntriesOptions();
gpo.setAllUsers(true);
List<IProtectionEntry> peList = server.getProtectionEntries(null, gpo);
//Create a new Protection entry
IProtectionEntry pe = new ProtectionEntry();
pe.setGroup(true);
pe.setName(groupName);
depotFilePath = "//depottest/Level1/Level2/..."; // the folders exist in Perforce
pe.setPath(depotFilePath);
pe.setMode("write");
pe.setHost("*");
pe.setPathExcluded(false);
pe.setOrder(peList.size());
pe.setType(EntryType.INCLUDE);
//Add the new created permission into the fetched Permission table list.
peList.add(pe);
//Create/Update the Permission table using either of the following methods separately or in combination creates a blank permission table.
server.createProtectionEntries(peList);
server.updateProtectionEntries(peList);
根據到底應該創建/替換/更新的權限表documentation的方法,但是,這種情況不會發生,而是許可表中Perforce服務器將被刪除/空白。
我可能會錯過一些東西。有人可以請提供一些關於如何解決這個問題的建議嗎?
P.S.我嘗試過只使用updateProtectionEntries(peList)
方法或server.createProtectionEntries(peList)
方法,並且兩者一起使用,但Perforce服務器中的Pemission表仍爲空白。