Getting current (logged) user security roles from the context is trivial:
Xrm.Page.context.getUserRoles()
But I can't find an answer how to get the roles for another user by Id or Name? (Different from the user who is logged on currently)
You can use odata to get roles assigned to user:
http://<server>/<org>/xrmservices/2011/OrganizationData.svc/SystemUserRolesSet?$filter=SystemUserId eq guid'<user guid>'
in similar way you possibly want to check for roles assigned to teams that user belongs to