See getUserDocGroups for getting user group information.
All $_REQUEST variables (including $_COOKIE) are available in MODx as they would in any PHP script, though beware of caching scripts that depend on these variables, as you typically want scripts that use these variables to remain dynamic rather than being statically cached.