Yes you can use the roleModule and userModule.
As a less clean process, you could also direclty access the database, it would work as of today. (there are 3 tables, one for users, one for roles and one to set roles to users.)
Information like portal object information (pages, windows...) are stored in the database, you can use related services or check the code of the management portlet to see how it is done.
question : why can't you use the usual *-object.xml to describe the pages, windows etc... of your portal ?
and put all this in a webapp (.war file) and deploy it like that ?
do you have a specific need ?
seems more simple to use the xml descriptor than programatically write all this setup of your portal.
for the users : see also how it is done the first time the portal launch, for the creation of the two default user (user and admin).
they are set by a file :
this file is used by hibernate to populate the user and role tables at first launch.
It shows how to populate some user with the UserImpl and RoleImpl classes. You can reuse this to write some better way to do it than just replacing this file.
you could also launch a sql script to populate automatically the tables with your user definition.
Thanks for replying, special thanks to Antoine. I had the wrong question in mind when I was searching for an API. After all, you simply deploy anything in JBoss, don't you, even portal pages ...