weirdnet-access-0.1.0 has been yanked.
weirdnet-access
Access policy for Weirdnet apps. It answers "may this peer do this to this resource?" the same way in every app.
- Two independent settings. Visibility is
private(only the owner and trusted peers know it exists; members must be trusted too) orpublic. Access isopen(no membership needed) orgated(a valid membership is needed). On the wire it is alwaysgated; CLIs may also acceptmembers,memberandclosed. New resources default to Private + Open. - A shared permission core that apps extend. The core is
read,members.list,members.approve,members.invite,members.kick,members.role,members.defaultsandroles.manage. Apps add their own, with implications (files.deleteincludesfiles.write, which includesfiles.read), followed transitively. Cycles are refused. - Ranked roles that users can change. Each role has a name, a rank and permissions.
The rank rules are Muninn's. Presets:
owner_member(Morph) andranked(owner/admin/user/viewer, Muninn). - Owner, member and guest actors. Guests act under the resource's guest role only on Open resources, and never with managing permissions.
- Enforcement in a fixed order. Identity, visibility, membership, role, then transport. Private or Gated content goes sealed; Public + Open goes plain.
use *;
let mut catalog = core;
catalog.add?;
catalog.add?;
catalog.imply?;
let roles = ranked?;
let settings = Settings ;
// From weirdnet-net: the node cert, the trust list, and `check_presented` on the membership.
let facts = Facts ;
assert!;
let stranger = Facts ;
assert_eq!;
# Ok::
The steps
| Step | Private | Public |
|---|---|---|
| 1. Identity | revoked node: not found | revoked node: denied |
| 2. Visibility | not the owner and not trusted: not found (members must be trusted too) | continue |
| 3. Membership (Gated) | no membership: not found | no membership: join first |
| 4. Role | the role must allow it | the role must allow it |
| 5. Transport | sealed | sealed if Gated, plain if Open |
Rank rules
- The owner can do everything, and only the owner grants the builtin
ownerrole. That role always holds*and can't be edited or removed. - Everyone else may grant, create, edit and remove only roles ranked below their own, and
may kick or re-role only members ranked below them. Only the owner makes a role with
*. - Removing a role moves its members to the lowest remaining role. A role that is the default for join requests, invites or guests can't be removed until the default changes.
The crate doesn't depend on weirdnet-net. Apps pass in facts they have already checked. See SECURITY.md.
License: BSD-3-Clause.