The fact that a developer is showing off work that he/she has done for other another company doesn't imply that that developer owns any copyright to the work.
In Canada, see the Copyright Act, § 13 (3):
Where the author of a work was in the employment of some other person under a contract of service or apprenticeship and the work was made in the course of his employment by that person, the person by whom the author was employed shall, in the absence of any agreement to the contrary, be the first owner of the copyright
and § 13 (4):
The owner of the copyright in any work may assign the right...
In the US, see 17 U.S.C. § 201 (b):
In the case of a work made for hire, the employer or other person for whom the work was prepared is considered the author for purposes of this title, and, unless the parties have expressly agreed otherwise in a written instrument signed by them, owns all of the rights comprised in the copyright.
and § 201 (d):
The ownership of a copyright may be transferred...
"What rights should and should not be attributed to the developer?"
That is a business decision to be made on a case-by-case basis. Advice about the prudent balance of copyright between an employer/client and employee/contractor is legal advice.
"Is it okay to use this projects as part of the developer's portfolio?"
If the developer can link to public use of a product that he/she developed for a company, then the developer is not violating copyright by simply advertising that they worked on the product and linking to, without reproducing, the work.
If the developer for whatever reason maintained copyright ownership in the code and other assets, it would not be copyright infringement to reproduce those as part of the portfolio.
If the developer did not maintain copyright ownership in the code or assets, reproducing those may be copyright infringement, dependent on whether the copyright owner allowed the developer to reproduce those elements, or if the reproduction is fair use.
There may be other laws or contracts implicated, though: non-disclosure agreements, trademark law, among others.