Pages

Tuesday, March 27, 2012

Job to export all AX 2009 security groups to files

I have been changing security a bunch lately and it's nice to have a backup of your previous settings if you make a mistake.  Here is a quick job I wrote to export your existing security settings to a folder.



static void ExportSecurityGroups(Args _args)
{
    SysSecurityUserGroup    sysSecurity = SysSecurityUserGroup::construct();
    UserGroupInfo           userGroupInfo;
    DomainInfo              domainInfo;

    #file
    Dialog                dialog  = new Dialog("@SYS14863");
    DialogField           dialogFileName;
    DialogField           dialogDomain;
    Object                formdialog;
    ;

    dialogFileName = dialog.addField(typeid(FilePath),"@SYS16423");
    dialogDomain    = dialog.addField(typeid(DomainId), "@SYS89852");
    dialog.doInit();
    formdialog = dialog.formRun();
    formdialog.filenameLookupTitle("@SYS53669");

    if (dialog.run() && WinAPI::pathExists(dialogFileName.value())  &&
        (dialogDomain.value() == ''     ||
         (select firstonly domainInfo where domainInfo.Id == dialogDomain.value()).recId != 0))
    {
        if (dialogDomain.value() == '')
            dialogDomain.value('Admin');
        
        while select userGroupInfo
        {
            sysSecurity.parmUserGroupId(userGroupInfo.id);
            sysSecurity.parmDomainId(dialogDomain.value());
            sysSecurity.load();
            sysSecurity.export(dialogFileName.value() + @'\' + dialogDomain.value() + '_' + userGroupInfo.id + '.asg');
        }
    }
    else
        warning("No action taken...");

    info("Done");
}

18 comments:

  1. Nice tool, but there is something missing: the Domain. When I tried running it, all of the groups contained empty information. Before the dialog setup (the first line of runnable code), I added:
    sysSecurity.parmDomainId([DomainId]);

    Now everything exports properly. For implementations with multiple domains, you may want to go a little bit further and add a dropdown box to select which domain to export from.

    ReplyDelete
    Replies
    1. Great comment. The environment I was working in didn't use Domains so I spaced them. I've updated the job to work with domains.

      Delete
  2. I am thankful to you for sharing this plethora of useful information. I found this resource utmost beneficial for me. Thanks a lot for hard work. Melbourne Integriti

    ReplyDelete
  3. Going to graduate school was a positive decision for me. I enjoyed the coursework, the presentations, the fellow students, and the professors. And since my company reimbursed 100% of the tuition, the only cost that I had to pay on my own was for books and supplies. Otherwise, I received a free master’s degree. All that I had to invest was my time. security guards

    ReplyDelete
  4. I got this blog site through my friends and when Home Security Companies I searched this really there were informative articles at the place.

    ReplyDelete
  5. I haven't yet met an unsuccessful job seeker who was in some way lacking in self-confidence. It is one of the reasons that I decided to in part cross the divide and become a CV Writer, because universally in most job searches the CV is a common point. Job consultancy

    ReplyDelete
  6. Most job boards do not allow for listing of emails, URL's, use of copyrighted material, defamatory remarks, false, inaccurate or misleading information, illegal or unethical content. Job postings that encourage job seekers to email for more details, are usually prohibited.How to Make cover letter

    ReplyDelete
  7. With a chronological resume, ashamed of being unemployed it requires someone to look at each job and try to ascertain or guess what skills a person has and in a competitive job market that type of extensive review may not be conducted.

    ReplyDelete
  8. Well, it’s a nice one, I have been looking for. Thanks for sharing such informative stuff.
    Continued

    ReplyDelete
  9. Thank you so much for sharing this great blog.Very inspiring and helpful too.Hope you continue to share more of your ideas.I will definitely love to read. https://paradiseeventproductions.com/surveillance-cameras-and-home-security/

    ReplyDelete
  10. I definitely enjoying every little bit of it and I have you bookmarked to check out new stuff you post. vape attic olathe

    ReplyDelete
  11. I have read your article, it is very informative and helpful for me.I admire the valuable information you offer in your articles. Thanks for posting it.. visit this page

    ReplyDelete
  12. As a seller of legal steroids, you can buy Crazy Bulk products, explore stacks and finally get the body you’ve always wanted good morning messages

    ReplyDelete
  13. I went over this web site and I think you have a lot of great information, saved to fav (:. Unique Dofollow Backlinks

    ReplyDelete
  14. Wow! Such an amazing and helpful post this is. I really really love it. It's so good and so awesome. I am just amazed. I hope that you continue to do your work like this in the future also https://securitysingapo.livejournal.com/281.html

    ReplyDelete
  15. Took me time to read all the comments, but I really enjoyed the article. It proved to be Very helpful to me and I am sure to all the commenters here! It’s always nice when you can not only be informed, but also entertained! security guard company in Singapore

    ReplyDelete
  16. All the contents you mentioned in post is too good and can be very useful. I will keep it in mind, thanks for sharing the information keep updating, looking forward for more posts.Thanks security guard agency

    ReplyDelete
  17. Others need to know job area. Most job sheets guarantee that an elegantly composed job posting can accomplish a lot more qualified applications than an ineffectively composed job posting. földmunkagép szállítás Europa-Road Kft.

    ReplyDelete