From: Gary Stainburn <gary.stainburn@ringways.co.uk>
To: pgsql-sql@postgresql.org
Subject: My First Function
Date: Sun, 1 Jul 2001 16:30:07 +0100
Message-ID: <01070116300703.07831@gary.ringways.co.uk> (raw)
Hi all,
Background
To date I've been using perl and DBI/DBD:Pg. I've done everything except SQL
stuff in perl and done okay(ish).
I'm just about to teach myself PHP before starting a new project, and have in
front of me a problem. A number of perl subs that I've used in the past will
now need porting to PHP. Any new routines would need to to written in both.
Thus, I've decided to also learn plsql in an attempt reduce my workload. As
I work best from examples and tutorials than I do from manuals, I was
wondering if some kind sole would write my first function for me. (This task
is a little extreme, basically what I will need)
The function I want is to provide access control to functions I will be
writing on a web site for REVCOM, a UK Charity. The idea is that I have
members who may hold positions on the management committee. There is a
many-to-many relationship between positions and members. Access to functions
is dependant on the position held by a member. For example, the treasurer
can update the accounts, the secretary can view the accounts. If both
positions are held by the same person then the treasurer's rights should be
returned for that function. The result should be an integer where -1 = no
access, or a +ID gives increasing permissions.
I want to be able to pass a member ID and a function ID and return the
highest permission for the two. The cut-down schema is:
Members table holds member details
MID int4 (Primary key) member ID
Functions table holds function details
FID int4 (Primary key) function ID
Positions table Holds Comittee Position details
PID int4 (Primary key) Position ID
Holder table Relationship between members and positions
HMID int4 Position holding member's ID
HPID int4 Position ID
Permissions table Relationship between functions and committee positions
PFID int4 Function ID
PPID int4 Position ID
PPERM permission level
I understand that this is a biggie, but I thought if I could understand how
this worked, I could learn much from it.
--
Gary Stainburn
This email does not contain private or confidential material as it
may be snooped on by interested government parties for unknown
and undisclosed purposes - Regulation of Investigatory Powers Act, 2000
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: gary.stainburn@ringways.co.uk
Subject: Re: My First Function
In-Reply-To: <01070116300703.07831@gary.ringways.co.uk>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox