#1 2016-11-24 03:34:17

erick
Member
Registered: 2015-09-09
Posts: 155

AccessRights - I don't understand

I'm looking at the Group Access Rights and they are like
grp.AccessRights := '14,3-256,0,3-256,0,3-256,0,3-256,0';

What does the 14 mean, the 3-256 mean, etc.

I searched and couldn't find an explanation anywhere in the documentation.

Offline

#2 2016-11-24 08:08:40

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,667
Website

Re: AccessRights - I don't understand

The text maps TSQLAccessRights content.
They follow its fields, as detailed in http://synopse.info/files/html/api-1.18 … CESSRIGHTS
So 14 maps AllowRemoteExecute, 3-256 maps GET, and so on.

procedure TSQLAccessRights.FromString(P: PUTF8Char);
begin
  FillcharFast(self,sizeof(self),0);
  if P=nil then
    exit;
  AllowRemoteExecute := TSQLAllowRemoteExecute(byte(GetNextItemCardinal(P)));
  SetBitCSV(GET,MAX_SQLTABLES,P);
  SetBitCSV(POST,MAX_SQLTABLES,P);
  SetBitCSV(PUT,MAX_SQLTABLES,P);
  SetBitCSV(DELETE,MAX_SQLTABLES,P);
end;

function TSQLAccessRights.ToString: RawUTF8;
begin
  result := FormatUTF8('%,%,%,%,%',
    [Byte(AllowRemoteExecute),
     GetBitCSV(GET,MAX_SQLTABLES), GetBitCSV(POST,MAX_SQLTABLES),
     GetBitCSV(PUT,MAX_SQLTABLES), GetBitCSV(DELETE,MAX_SQLTABLES)]);
end;

Offline

#3 2016-11-24 17:10:58

erick
Member
Registered: 2015-09-09
Posts: 155

Re: AccessRights - I don't understand

I've figured out almost everything else I need, but this escapes me.

14 maps AllowRemoteExecute to what?  It's not function #14.  Why is it not 13, or 12.  What does 14 mean?


Also, the CRUD numbers - I'm assuming a bitfield for 0-256 tables ordered from the database tables.

So I tried an experiment:

// grp.AccessRights was = '14,3-256,0,3-256,0,3-256,0,3-256,0';
grp.SQLAccessRights.Edit(1, True, false, false, false);
TSQLLog.Add.Log(sllTrace, 'accessrights % ',  [UTF8toString(grp.AccessRights)]);

to see how the bits get changed.  But they didn't.

20161124 16542458 res   SynSQLite3.TSQLDatabase(027CAC30) [{"ID":5,"Ident":"EWBlogin","SessionTimeout":60,"AccessRights":"14,3-256,0,3-256,0,3-256,0,3-256,0"}]
20161124 16542717 trace accessrights 14,3-256,0,3-256,0,3-256,0,3-256,0

No change.  So I clearly don't understand this.

Thanks in advance
Erick

Offline

#4 2016-11-24 19:52:46

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,667
Website

Re: AccessRights - I don't understand

You are changing a copy of the record, not the record itself...

Offline

#5 2016-11-25 01:14:33

erick
Member
Registered: 2015-09-09
Posts: 155

Re: AccessRights - I don't understand

Thanks, I have it figured out now.

Offline

Board footer

Powered by FluxBB