* @param groups Container for Group ACEs
* @param finalAce ACE that needs to be added to the ACL
*/
protected void addAceToSet(Set<Principal> users, Set<Principal> groups,
ACE finalAce) {
SID sid = finalAce.getSID();
int sidType = sid.getType();
String aclEntry = sid.toDisplayString();
int ix = aclEntry.indexOf('\\');
if (ix > 0) {
String domain = aclEntry.substring(0, ix);
String userOrGroup = aclEntry.substring(ix + 1);
if (sidType == SID.SID_TYPE_USER) {
aclEntry = AclFormat.formatString(userAclFormat, userOrGroup, domain);
} else {
aclEntry = AclFormat.formatString(groupAclFormat, userOrGroup, domain);
}
}
switch (sidType) {
case SID.SID_TYPE_USER:
// TODO: I don't think SID supports local users, so assume global.
users.add(new Principal(userAclFormat.getPrincipalType(),
globalNamespace, aclEntry,
CaseSensitivityType.EVERYTHING_CASE_INSENSITIVE));
break;
case SID.SID_TYPE_DOM_GRP:
case SID.SID_TYPE_DOMAIN:
groups.add(new Principal(groupAclFormat.getPrincipalType(),
globalNamespace, aclEntry,
CaseSensitivityType.EVERYTHING_CASE_INSENSITIVE));
break;
case SID.SID_TYPE_ALIAS:
case SID.SID_TYPE_WKN_GRP:
if (ix < 0 && !Strings.isNullOrEmpty(sid.getDomainName())) {
aclEntry = AclFormat.formatString(groupAclFormat, aclEntry,
sid.getDomainName());
}
groups.add(new Principal(groupAclFormat.getPrincipalType(),
globalNamespace, aclEntry,
CaseSensitivityType.EVERYTHING_CASE_INSENSITIVE));
break;