Businesses (in its broadest meaning) may be organized under either federal or provincial laws in Canada in parallel.
Federally, a cooperative may be formed under the Canada Cooperatives Act. Under federal law, membership in a federally incorporated cooperative must be "open, in a non-discriminatory manner, to persons who can use the services of the cooperative and who are willing and able to accept the responsibilities of membership" according to s. 7(1)(a), "subject to any restrictions on the classes of persons to which membership may be available that may reasonably relate to any business restriction set out in the articles of the cooperative and to the reasonable commercial ability of the cooperative to provide services to prospective members, as long as the restrictions are consistent with applicable laws with respect to human rights" under s. 7(2).
The central aspect of a cooperative is that the coop must provide services to members and the membership rule is open and non-discriminatory, other than for explicit business reasons.
I did not check all provinces' cooperative acts, but at least in Alberta and Manitoba, the basis of membership rules are similar to the federal rules. In Alberta's case, the cooperative can impose any restriction on membership not in violation of human rights laws.
a community cooperatives where anyone in the community can be a member
Depending on how community is defined. Membership based on restrictions of race, sex, national origins etc. may or may not be held as a violation of human rights laws depending on specifics.
A geographical community based cooperative focusing on local development for example should usually be acceptable.
employee cooperatives where a company is owned by employees of a certain other company
In any case an incorporated body that is not owned by its own employees is not a worker cooperative within the meaning of the Cooperative Acts. Specific worker coop rules apply to coops where their own employees are members of the coop.
But it could well be another type of coop. Membership restriction based on employment is usually acceptable and a coop, other than a worker coop, may employ non-members freely and all coops may own subsidiary assets, including other corporations.