def get_user_info(user):
user = api.get_user(user)<EOL>current = api.get_current_user()<EOL>if api.is_anonymous():<EOL><INDENT>return {<EOL>"<STR_LIT:username>": current.getUserName(),<EOL>"<STR_LIT>": False,<EOL>"<STR_LIT>": current.getRoles(),<EOL>"<STR_LIT>": api.url_for("<STR_LIT>", username="<STR_LIT>"),<EOL>}<EOL><DEDENT>if user is None:<EOL><INDENT>logger.warn("<STR_LIT>".format(user))<EOL>return None<EOL><DEDENT>pu = user.getUser()<EOL>info = {<EOL>"<STR_LIT:username>": user.getUserName(),<EOL>"<STR_LIT>": user.getRoles(),<EOL>"<STR_LIT>": pu.getGroups(),<EOL>"<STR_LIT>": current == user,<EOL>"<STR_LIT>": api.url_for("<STR_LIT>", username=user.getId()),<EOL>}<EOL>for k, v in api.get_user_properties(user).items():<EOL><INDENT>if api.is_date(v):<EOL><INDENT>v = api.to_iso_date(v)<EOL><DEDENT>if not api.is_json_serializable(v):<EOL><INDENT>logger.warn("<STR_LIT>".format(k))<EOL>continue<EOL><DEDENT>info[k] = v<EOL><DEDENT>return info<EOL>
Get the user information