Hi Hasan,
There are some BAPI's which handles the Role & Profile assignments for for a User.
Instead of Assignment of Authorization directly, you can create appropriate Profiles and can make use of these profiles to assign necessary roles. BAPIs which can be used are BAPI_USER_PROFILES_ASSIGN, OR BAPI_USER_ACTGROUPS_ASSIGN.
Hope this helps
- Harshad