public with sharing class PBIAuthorizationController {
|
public string userid {get; set;}
|
public string UserName {get; set;}
|
public string PBIId {get; set;}
|
public boolean ISUser {get; set;}
|
public PBIAuthorizationController() {
|
userid = ApexPages.currentPage().getParameters().get('userid');
|
}
|
public void init() {
|
try {
|
list<User> tempUser = new list<User>();
|
if (!string.isblank(userid)) {
|
tempUser = [select id,Name from User where id = :userid];
|
}
|
if (string.isblank(userid) || tempUser.size() == 0) {
|
ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error ,
|
'没有找到对应的用户'));
|
return;
|
} else {
|
ISUser = true;
|
UserName = tempUser[0].Name;
|
List<PBIAuthorization__c> tempPBIA =
|
[select id from PBIAuthorization__c where User__c = : userid];
|
if (tempPBIA.size() > 0) {
|
PBIId = tempPBIA[0].id;
|
}
|
}
|
if(test.isrunningTest()){
|
throw new ControllerUtil.myException('111');
|
}
|
} catch (exception e) {
|
ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error ,
|
'' + e));
|
return;
|
}
|
}
|
}
|