Security for Dimesnions

bhuberbhuber Member Posts: 78
edited 2004-05-04 in Navision Attain
Has anyone written or is awhare of anyone who has written security for dimensions. Can you specify wheich dimensions may be entered on a transaction by a user, or restrict which dimensions are viewable by a user.

Comments

  • RobertMoRobertMo Member Posts: 484
    I have done something like that.
    There are some some fileds in user setup and dimension value tables.
    and of course some code on Dimension value form to do the filtering.
    since filtering is using filtergroup other then 0, user cannot remove filters...
               ®obi           
    ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
  • RobertMoRobertMo Member Posts: 484
    Here are some more datails:

    Table 349 - Dimension Value
    New field:
    "DimValue Group" Code 20
    

    Table 91 - User Setup
    New field:
    "DimValue GroupFilter" Code50
    

    You define on each DimValue record a "DimValue Group". You can use some special subtable or just plain A,B,C...

    In UserSetup record you enter a filter that will be valid for each user: *A* or *A*|*B* or *C*

    On open form of DimValue List (F560) you just use something like that:
    DimValue.SETFILTER("DimValue Group", rUserSetup."DimValue GroupFilter");
    

    Example:
    "DimCode" "DimValue Group"
    --------------------------
    Code1     A
    Code2     B
    Code3     C
    Code4     AC
    
    "UserID" "DimValue GroupFilter"
    -------------------------------
    User1     *A*
    User2     *B*
    User3     *A*|*B*
    User4     *C*
    User5     *
    
    After setting the filters,
    User1 will see Code1 and Code4
    User2 will see Code2
    User3 will see Code1 and Code2 and Code4
    User4 will see Code3 and Code4
    User5 will see everything
    

    As you see DimValue can belong to more groups and user can see more groups. We have many to many relationship, so practically you can achieve any combination you want.

    Also you can choose default behaviour if nothing is set on user (see everything or see nothing-more secure).

    Some more security ?
    Use FILTERGROUP function to prevent user from removing filters:
    DimValue.FILTERGROUP(2);
    DimValue.SETFILTER("DimValue Group", rUserSetup."DimValue GroupFilter");
    DimValue.FILTERGROUP(0);
    

    Even some more security ?
    Use this code when validating dimensions.
    Even some more security ?
    Use this code when posting dimensions.

    Here's also exact code that I use (some more code to work nicely)
    From 560 - Dimension Values

    OnOpenForm()
    Rec.FIND('=><');
    IF lrUserSetup.GET(DATABASE.USERID) THEN BEGIN
      // remember existing filters
      ltFilterDimCode := Rec.GETFILTER("Dimension Code");
      ltFilterGlobalDimNo := Rec.GETFILTER("Global Dimension No.");
      // set existing filters on different FILTERGROUP
      Rec.FILTERGROUP(2);
      IF ltFilterDimCode <> '' THEN Rec.SETFILTER("Dimension Code", ltFilterDimCode);
      IF ltFilterGlobalDimNo <> '' THEN Rec.SETFILTER("Global Dimension No.", ltFilterGlobalDimNo);
      Rec.SETFILTER("DimValue Group", '*' + lrUserSetup."DimValue GroupFilter" + '*');
      Rec.FILTERGROUP(0);
    END;
    
               ®obi           
    ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
  • Erik_EErik_E Member Posts: 17
    Or you could use the permissions in the autorisation, but then you will have to use sql database. It fairly works. You can set a filter on the dimension values this way.
Sign In or Register to comment.