public void RevokeRole(Role role) { ThrowIfDisabled(); ThrowIfRoleNotGranted(role); Apply( new RoleRevokedFromUser(Id, role.Id)); }
void ThrowIfRoleNotGranted(Role role) { if (!_roles.Contains(role.Id)) throw new Exception("Yo bro, this role was never granted in the first place!"); }
public void GrantRole(Role role) { ThrowIfDisabled(); Apply( new RoleGrantedToUser(Id, role.Id)); }