use of dev.hawala.xns.level4.filing.FilingCommon.AccessList in project dodo by devhawala.
the class AttributeUtils method file2courier_accessList.
/*
* FileEntry => Courier
*/
private static void file2courier_accessList(AttributeSequence s, long atCode, boolean isDefaulted, List<AccessEntry> accessEntries, boolean forFiling4) {
AccessList acl = forFiling4 ? AccessList.make4() : AccessList.make5or6();
acl.defaulted.set(isDefaulted);
for (AccessEntry a : accessEntries) {
FilingCommon.AccessEntry fa = acl.entries.add();
fa.key.from(a.key);
if (a.access == FsConstants.fullAccess) {
// fa.access.add().set(AccessType.fullAccess);
fa.access.add(AccessType.readAccess);
fa.access.add(AccessType.writeAccess);
fa.access.add(AccessType.ownerAccess);
fa.access.add(AccessType.addAccess);
fa.access.add(AccessType.removeAccess);
} else {
if ((a.access & FsConstants.readAccess) != 0) {
fa.access.add(AccessType.readAccess);
}
if ((a.access & FsConstants.writeAccess) != 0) {
fa.access.add(AccessType.writeAccess);
}
if ((a.access & FsConstants.ownerAccess) != 0) {
fa.access.add(AccessType.ownerAccess);
}
if ((a.access & FsConstants.addAccess) != 0) {
fa.access.add(AccessType.addAccess);
}
if ((a.access & FsConstants.removeAccess) != 0) {
fa.access.add(AccessType.removeAccess);
}
}
}
Attribute attr = s.value.add();
try {
attr.encodeData(acl);
} catch (Exception e) {
new UndefinedErrorRecord(FilingCommon.UNDEFINEDERROR_ENCODE_ERROR).raise();
}
attr.type.set(atCode);
}
use of dev.hawala.xns.level4.filing.FilingCommon.AccessList in project dodo by devhawala.
the class AttributeUtils method courier2file_accessList.
private static void courier2file_accessList(Attribute a, FileEntry fe, boolean isDefaultAcl) {
AccessList acl = null;
try {
// try as post-version 4 AccessLIst
acl = a.decodeData(AccessList::make5or6);
} catch (Exception e) {
// does not seem to be version 5 or 6, so check for version 4
}
if (acl == null) {
try {
// try as version 4 AccessList
acl = a.decodeData(AccessList::make4);
} catch (Exception e) {
// none of the supported versions was ok, so use defaults
acl = AccessList.make5or6();
}
}
if (isDefaultAcl) {
fe.setDefaultAccessListDefaulted(acl.defaulted.get());
} else {
fe.setAccessListDefaulted(acl.defaulted.get());
}
List<AccessEntry> aes = (isDefaultAcl) ? fe.getDefaultAccessList() : fe.getAccessList();
aes.clear();
for (int i = 0; i < acl.entries.size(); i++) {
FilingCommon.AccessEntry ac = acl.entries.get(i);
String key = ac.key.getString();
int access = 0;
if (ac.access.has(AccessType.fullAccess)) {
access |= FsConstants.fullAccess;
}
if (ac.access.has(AccessType.readAccess)) {
access |= FsConstants.readAccess;
}
if (ac.access.has(AccessType.writeAccess)) {
access |= FsConstants.writeAccess;
}
if (ac.access.has(AccessType.ownerAccess)) {
access |= FsConstants.ownerAccess;
}
if (ac.access.has(AccessType.addAccess)) {
access |= FsConstants.addAccess;
}
if (ac.access.has(AccessType.removeAccess)) {
access |= FsConstants.removeAccess;
}
AccessEntry ae = new AccessEntry(key, access);
aes.add(ae);
}
;
}
Aggregations