Forum Discussion

BSK's avatar
BSK
New Contributor III
3 years ago

Restriction of posting "Unbalanced" journals when creating the journals manually

Hi,

Is there any option to restrict some of the users to post unbalanced journals ? we are able to restrict it in the journal templates. But we also want to restrict when user try to create by clicking on "Create Journal".

Using the event Journal rules, we are able to restrict for all the users ( Including admin). Need the solution to limit this to section of users.

 

Thanks.

 

 

  • In your handler, you can just look up your user groups and react accordingly.

    This should work pretty much anywhere...

    Dim objUserInfo As UserInfo = BRApi.Security.Authorization.GetUser(si, si.UserName)
    If objUserInfo.ParentGroups.ContainsValue(BRApi.Security.Admin.GetGroup(si, groupName).Group) Then
    	....
    

    whereas this is specific to journal extenders:

    Using dbConnFW As DbConnInfo = BRApi.Database.CreateFrameworkDbConnInfo(si)
    	Dim objUserInfo As UserInfo = EngineUsers.GetUser(dbConnFW, yourJournalObject.Header.Header.CreatedUserID)
    	If objUserInfo.ParentGroups.ContainsValue(BRApi.Security.Admin.GetGroup(si, groupName).Group) Then

     

  • BSK's avatar
    BSK
    New Contributor III

    Thanks Jack. The first option is now fit for our requirement. The only flaw i see is, users are still able to post / unpost the existing unbalanced journals unless they are rejected. No issues with the new journals.

     

  • JackLacava's avatar
    JackLacava
    Honored Contributor

    In your handler, you can just look up your user groups and react accordingly.

    This should work pretty much anywhere...

    Dim objUserInfo As UserInfo = BRApi.Security.Authorization.GetUser(si, si.UserName)
    If objUserInfo.ParentGroups.ContainsValue(BRApi.Security.Admin.GetGroup(si, groupName).Group) Then
    	....
    

    whereas this is specific to journal extenders:

    Using dbConnFW As DbConnInfo = BRApi.Database.CreateFrameworkDbConnInfo(si)
    	Dim objUserInfo As UserInfo = EngineUsers.GetUser(dbConnFW, yourJournalObject.Header.Header.CreatedUserID)
    	If objUserInfo.ParentGroups.ContainsValue(BRApi.Security.Admin.GetGroup(si, groupName).Group) Then

     

  • Hi

    Question with regards to you event handler.

    1. Did you physically restrict users from using the button " create journal"

    2. If you did, which "BREventOperationType.Journals." operation name did you use?

    Thanks

    • BSK's avatar
      BSK
      New Contributor III

      Hi,

      1. Did you physically restrict users from using the button " create journal"

      Ans: NO

      We have used  Extensibility rules(Journal event handler ), which will restrict all the users (including admin) to post unbalanced Journals.

      They can see all the options ( Balanced, Unbalanced, Balanced by Entity), but system will not allow to post the journals in any case, If it's not balanced.