Disable a particular dimension for a particular user group

rashi.kaushikrashi.kaushik Member Posts: 52
edited 2006-01-17 in Dynamics AX
Hi all,

Is there a way in Axapta by which i can disable a particular dimension(say CostCenter) from all the forms for a particular user group.

Thanx in advance

Comments

  • MugurMugur Member Posts: 93
    Yep, you can do that by updating the SysSetupFormRun.init() method to look like below:
        FormDataSource  f;
        FormDataObject  o;
        int             i;
        DictField       df;
        ;
    
        super();
        SysSecurityFormSetup::loadSecurity(this);
    
        if (curuserid()=="Admin")
        {
            for (i=1;i<=this.dataSourceCount();i++)
            {
                f   = this.dataSource(i);
                df  = new DictField(f.cursor().TableId,fieldid2ext(fieldname2id(f.cursor().TableId,"Dimension"),2));
                if (df)
                {
                    o    = f.object(df.id());
                    o.allowEdit(false);
                }
            }
        }
    

    Yet, I didn't researched how you can find if the current user belong to a certain group. If you'd knew that, the code can be used directly for a group rather than for individual users like I did. A hint to research that: MainMenu\Administration\Users\Groups tab , see the code for populating the Selected groups list :wink:
    Kind regards,

    Ciprian Dudau
    Axapta Developer
  • rashi.kaushikrashi.kaushik Member Posts: 52
    Thanx Mugur,
    Its working fine now.

    Thanx a lot
    Rashi
  • HarishHarish Member Posts: 172
    To Mugur -

    >>Yet, I didn't researched how you can find if the current user belong to >>a certain group

    Here is an example -

    Let us say you have created a user group under Accounts Receivable -> Parameters. Let us call this group - 'SalesAdmn'

    So in your code you can check like this -
    select userGroupList where userGroupList.userId == curUserID() &&
             userGroupList.groupId == SalesParameters::find().SalesAdmn;
    
    if (userGroupList) 
            {
                    ......
             }
    

    Hope this helps,

    Harish Mohanbabu
    Harish Mohanbabu
    Long way to go before I sleep..
  • MugurMugur Member Posts: 93
    Hi Harish,

    That's what I was talking about.

    Thanks for the solution.
    Kind regards,

    Ciprian Dudau
    Axapta Developer
Sign In or Register to comment.