#1 2011-12-06 11:11:42

esmondb
Member
From: London
Registered: 2010-07-20
Posts: 299

Setting up AuthGroup rights

It doesn't seem that easy to set up the AuthGroup table rights. Would it be worth adding a function like below to TSQLAuthGroup?

procedure TSQLAuthGroup.EditTableRights(TableIndex: integer; C, R, U, D: boolean);
var
  A: TSQLAccessRights;
begin
  A := SQLAccessRights;
  if not C then
    Exclude(A.PUT, TableIndex);
  if not R then
    Exclude(A.GET, TableIndex);
  if not U then
    Exclude(A.POST, TableIndex);
  if not D then
    Exclude(A.DELETE, TableIndex);
  SQLAccessRights := A;
end;

Offline

#2 2011-12-06 12:38:19

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

Re: Setting up AuthGroup rights

Good idea.

But your implementation won't work, e.g. if you set access rights after having disabled it (e.g. C=true after C=false).
And also you made a confusion between POST=Create=Add and PUT=Update

And it will be a bit slow at the TSQLAuthGroup level.

I've re-declared TSQLAccessRights record as an object, and added some dedicated methods: FromString, ToString, Edit.

See http://synopse.info/fossil/info/8090be0806

Offline

#3 2011-12-06 13:01:49

esmondb
Member
From: London
Registered: 2010-07-20
Posts: 299

Re: Setting up AuthGroup rights

Thanks for such a quick response.

Offline

Board footer

Powered by FluxBB