reference group
If, say, 5-6 years ago I mostly relied on the Java people, say, in Google, regarding professional opinions, now, it seems like, английский не особо-то и нужон, ну разве что чтобы выразить термины. Все тут собрались. Классно!
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | lazy val permissionBits = { val primary: Int = Permission.Base.Read .mask(file.canRead ) | Permission.Base.Write .mask(file.canWrite) | Permission.Base.Delete.mask(file.canDelete) val permBits = for (acl <- Option(file.cmis.getAcl); aces <- Option(acl.getAces); ace <- aces; name <- ace.getPermissions) yield CmisPermissions.forName(name).mask assert(permBits.sum == (0/: permBits) (_|_), "expected bits to be distinct") primary | permBits.sum } lazy val myPermission: Permission = new Permission(permissionBits) def granted(session: Session, masks: PermissionMask*): Boolean = myPermission allows (masks:_*) |