[AX2012 R3] about named User License report

Source: Internet
Author: User

Named User License report is used to count the number of users of various authorization types, here to see how the report data is specific. This is an SSRS report, and the primary data source is the RDP from the class Sysuserlicensecountreport definition, Use SYSUSERLICENSEMINER::FILLUSERLICENSECOUNTTMPTBL () in the Sysuserlicensecountreport method Processreport to populate a temporary table, The most central part of this is this approach:

 Public Static voidfilluserlicensecounttmptbl (sysuserlicensecounttmp _userliccounttbltmp, date _reportstatedate) {    Sysuserlicensecount sulctbl;    Sysuserlicenselist sulltbl;    Securityuserrole surtbl;    SecurityRole RTBL;    Sysrolelicensetype Userrolelicense;    Delete_from _userliccounttbltmp;    Ttsbegin;  while SelectValidtimestate (_reportstatedate, _reportstatedate) * fromsulctbl outer JOIN SULLTBL outer join User, SecurityRole fromsurtbl Join SecurityRole, Userlicensetype fromuserrolelicense Join RecId, Name fromrTbl ORDER BY sulctbl.userlicensetype Descwhere(Sulctbl.recid = =Sulltbl.sysuserlicensecount&& Sulltbl.username = = Surtbl.user && Userrolelicense.securityrole = =Surtbl.securityrole&& Rtbl.recid = =surtbl.securityrole) {_userliccounttbltmp.userlicensetype=Sulctbl.userlicensetype; _userliccounttbltmp.licensedcount=Sulctbl.licensedcount; _userliccounttbltmp.actualcount=Sulctbl.actualcount; _userliccounttbltmp.validfor=Sulctbl.validfrom; _userliccounttbltmp.networkdomain=Sulltbl.networkdomain; _userliccounttbltmp.networkalias=Sulltbl.networkalias; _userliccounttbltmp.username=Sulltbl.username; _userliccounttbltmp.securityrole=Rtbl.name; _userliccounttbltmp.securityrolelicensetype=Userrolelicense.userlicensetype;    _userliccounttbltmp.insert (); } Ttscommit;}

Several tables are used here, and Sysuserlicensecount holds the corresponding number of users for four types of user authorization (enumeration userlicensetype:enterprise,functional,task,self serve) Sysuserlicenselist saves the authorization record for each user whose Sysuserlicensecount record is the table Sysuserlicensecount recid;securityuserrole table is not in the AOT. View the database to know that each user's role is saved, if a user is assigned multiple role, each role in this table corresponds to a record, column SecurityRole save the specific role of id;securityrole is not in the AOT, Even SQL database does not have this table, fortunately in the above code can be inferred in the AOT all security roles list, here is used only role name; Sysrolelicensetype is not in the AOT, but in SQL database, It is important that the SecurityRole and Userlicensetype two fields, which record the ID of each role, are the appropriate user authorization type for this role, and each role has only one type of user authorization.

So the above code completes the construction of a temporary table to record each user's name, network alias, the corresponding role, the user authorization type for the role, the number of authorized users of the user authorization type, and the current usage of the user authorization type. It is important to note that the role "system administrator" and "system user" are not documented in table Sysrolelicensetype, and if a user has only these two roles, the user does not appear in the report, but the system Administrator will still occupy an enterprise license, only the system user will not affect the number of authorizations.

Run the report always get blank results, look closely to discover that there is a problem in the code above (R3 CU8 system), "&& sulltbl.username = = Surtbl.user", view the database table Securityuserrole, The user column actually saves the users ' network alias and Changes to "&& Sulltbl.networkalias = = Surtbl.user" and runs the report to get the result, similar to:

You also need to be aware that you must switch to the DAT company to have the data, the table Sysuserlicensecount and so on is not to save the company information, according to my understanding should be in any company should get the same results, but actually only switch to DAT company report only data.

Where does the data from the related tables come from next? When the system is deployed, a batch task called "Named User License Count reports processing" is automatically created for us, which updates the data to these tables and runs once a week by default. This batch task specifically executes the Sysuserlicenseminer class, the Run method calls Sysuserlicenseminer::generateuserlicensecountreportinfo (), We can also update the authorization Number data by calling this method directly. If you cannot find the job in the batch list, you can call Sysuserlicenseminer::createbatchjob () to create one for you. And how is it updated? The answer is naturally also in the Sysuserlicenseminer, here does not turn over the code, on the other place to see summary. A menu item is opened in the AOT, and there are two properties related to authorization, viewuserlicense and Maintainuserlicense, which are the authorizations required to view the data that is required to maintain the Their values are the enumerated Userlicensetype mentioned earlier. Sysuserlicenseminer's job is to traverse all of the menu item, find the appropriate user authorization, then traverse the user role, identify the user authorization type for each user role, and finally traverse each user, Identify the user's highest user authorization type (Enterprise highest). So the core of the problem is the type of user authorization for the menu item, what if we create a new menu item of our own? The default Viewuserlicense and Maintainuserlicense are none, does not affect the number of authorizations, of course, you can do nothing to modify the two properties into other values. We can duplicate the system to bring the menu items, and then modify the two properties to none, after the not elaborate.

The last thing to say is the format of this report, regardless of whether I check the "Show list of users per access License Type" Results are the same, report design is only one of the above picture, friends who know why, please tell me why ...

[AX2012 R3] about named User License report

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.