Guest User

Untitled

a guest
Jul 19th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.07 KB | None | 0 0
  1. @AuraEnabled
  2. public static List<AggregateResult> getProfileInfo() {
  3. List<AggregateResult> plist = new List<AggregateResult>();
  4. plist = [SELECT Parent.Profile.Name, COUNT(SObjectType) FROM ObjectPermissions
  5. WHERE (ParentId IN (SELECT PermissionSetId FROM PermissionSetAssignment))
  6. AND Parent.IsOwnedByProfile = true
  7. AND (SObjectType IN :sobjectNames)
  8. GROUP BY Parent.Profile.Name];
  9.  
  10. return plist;
  11. }
  12.  
  13. doInit: function(component, event, helper) {
  14. var cols1 = [
  15. {label: 'Profile Names', fieldName: 'Name', type: 'text'},
  16. {label: 'Object Counts', fieldName: 'ObjectName__c', type: 'Integer'}
  17. ];
  18.  
  19. component.set("v.tableCols1", cols1);
  20. },
  21.  
  22.  
  23. fetchProfileOnly : function(component, event, helper){
  24. alert('fetchProfileOnly called');
  25. var action = component.get("c.getProfileInfo");
  26. alert('*******'+action);
  27. action.setCallback(this, function(response) {
  28. var state = response.getState();
  29. alert('*******'+state);
  30. if (state === "SUCCESS") {
  31. alert('inside success');
  32. var profileWithObjCounts = response.getReturnValue();
  33. alert('****All Profile*****'+profileWithObjCounts);
  34. component.find(profileId).set("v.profileList", profileWithObjCounts);
  35. }
  36. });
  37. },
  38.  
  39. <aura:component controller="ConfigMonitoring" >
  40. <aura:handler name="init" value="{!this}" action="{!c.fetchProfileOnly}"/>
  41. <aura:attribute name="tableCols1" type="List" />
  42. <aura:attribute name="profileList" type="List"/>
  43. <div class="slds-card__body slds-card__body_inner" style="margin-top:10px;">
  44. <lightning:datatable data="{!v.profileList}"
  45. columns="{!v.tableCols1 }"
  46. keyField="Id"
  47. hideCheckboxColumn="true"
  48. />
  49. </div>
  50. </aura:component>
  51.  
  52. SELECT Parent.Profile.Name pn, COUNT(SObjectType) oc
  53.  
  54. var cols1 = [
  55. {label: 'Profile Names', fieldName: 'pn', type: 'String'},
  56. {label: 'Object Counts', fieldName: 'oc', type: 'Integer'}
  57. ];
Add Comment
Please, Sign In to add comment