码迷,mamicode.com
首页 > 其他好文 > 详细

RTC,登陆后添加权限值

时间:2016-09-07 01:01:56      阅读:246      评论:0      收藏:0      [点我收藏+]

标签:

修改单元:rtcMW.DM.Main;

修改组件:fnLogin

在方法中添加:

 服务端:

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;

编译服务端

 

客户端

文件: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;

 

RTC,登陆后添加权限值

标签:

原文地址:http://www.cnblogs.com/carcode/p/5847474.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!