RTC,登錄後添加權限值

修改單元:rtcMW.DM.Main;token

修改組件:fnLoginstring

在方法中添加:it

 服務端:io

const
SQL_SELECT_USER = 'SELECT * FROM Users WHERE UserName=:UserName';編譯

with TRtcHttpServer(Sender) do
begin
// OpenSession();
Session.asText['UserName'] := UserName;
Session.asText['UserID'] := FieldByName('UserID').AsString;
Session.asText['ConnectionDefName'] := ConnectionDef.Name;
Result.asRecord.asText['token'] := Session.ID.ToLower;
Result.asRecord.asInteger['UploadFileSizeMax'] := UploadFileSizeMax;
Result.asRecord.asString['Permission'] := FieldByName('permission').AsString; //添加此
end;function

編譯服務端權限

 

客戶端方法

文件:rtcMW.Comp.Client客戶端

 

1.服務端

 private

 FPermission:string; //權限

 

public

    property Permission:string read FPermission  write FPermission; //權限


function TRFConnection.DoLoginResult(Value: TRtcValue): Boolean;
begin
Result := False;
FAccessToken := EmptyStr;

if Value.isType = rtc_Record then
begin
FUserLoginState := TUserLoginState(Value.asRecord.asInteger['LoginState']);
Result := FUserLoginState = lsSucceed;
if Result then
begin
FAccessToken := Value.asRecord.asText['Token'];
FUploadFileSizeMax := Value.asRecord.asInteger['UploadFileSizeMax'];
FPermission:=Value.asRecord.asString['Permission']; //權限     新增
end;

if Assigned(FUserLoginEvent) then
FUserLoginEvent(FUserLoginState, FAccessToken);
end
else if Value.isType = rtc_Exception then
raise Exception.Create(Value.asException);

end;

相關文章
相關標籤/搜索