blasalle
Posts: 69
|
| Posted: 03/09/2010, 2:34 PM |
|
I would like to control access at the page level... I was thinking of creating a database table or tables that would store an authorization code - if the persons authorization code matched they could see the page. Ids there a more elegant approach? Also, Does CCS refer to pages by a name that I can use or should I just create one and use a lookup in the Before Show event?
bernie
_________________
Bernie
University of Utah
Salt Lake City, UT USA |
 |
 |
andy
Posts: 183
|
| Posted: 03/11/2010, 2:20 AM |
|
Hi Bernie
Have you discovered the Code Charge Studio security settings?
There is excellent granular security straight out of the box.
You first need to set up Security settings in Project Settings (Security and Security Groups).
On the "Security Groups" section in Project Settings:
You define Security Groups (e.g. administrator, member, guest etc.) each with a numeric Group ID.
On the "Security" section in Project Settings:
You specify your user table and define the User ID, login, password and group field (you may need to update your Users table to incorporate these fields).
On each page:
You can provide access to groups of users at page level or even at form level using the "Restricted" feature on the Data tab of Properties.
Example of an entire page being only accessible to administrators:
Click on the page (not on a form or form object). Check you are at page level by looking at the Properties Data tab, which should say Page:[pagename].
Second item on the Data tab is Restricted. Click Yes then click the elipsis to open the Page Security Groups dialog. Click restricted and click on the groups for whom you want to grant access to this page. Unchecked groups will NOT be able to access page.
Example of page with one record/grid accessible to everyone and one record/grid accessible only to administrators:
Click on the grid that you only want the administrator to access.
Check you are at record/grid level by looking at the Properties Data tab, which should say Record:[recordname] or Grid: [gridname].
Click Yes on the Restricted item on the Data tab, then click the elipsis to open the Record/Grid Security Groups dialog.
You can now specify what rights are assigned to each group (Read, Insert, Update, Delete, Full).
Repeat for each form/each page. If you don't define security settings the default is access for all.
Hope that helps...
_________________
Andy
RAD tools for rich UI controls:
http://www.koolphptools.com |
 |
 |
blasalle
Posts: 69
|
| Posted: 03/11/2010, 2:18 PM |
|
Andy - thanks for the response - yes we use CodeCharge Security settings a lot but our needs are more complex than the group level. I need to control an individual's access for each page and, depending on the circumstance, that person may have full rights to page_1, read only rights to page_2 and no access to page_3.
My understanding of the CodeCharge Security Groups is that you can only be in one group at a time (session) based on your login. What I'm implementing is a Before Show event that determines a persons access level for that page.
regards,
bernie
_________________
Bernie
University of Utah
Salt Lake City, UT USA |
 |
 |
melvyn
Posts: 333
|
| Posted: 03/11/2010, 8:40 PM |
|
You can refer to the current page as a constante defined in the start of each file: FileName
Place this inside an event:
echo "This page name is: " . FileName . " ";
As Andy told: you can define more refined permissions (only view, only update, only list and more) using a per-component security level.
Of course you can create a table and try a per-user auth level. It requires some advanced knowledge of CCS. I've placed a funciont in AfterInitialize event calling a code which will check this user and this page. You must read and try a lot.
Get and idea:
// This in AfterInitialize:
$user_id = CCGetSession("UserID");
$page = FileName;
// place code to connect to db.
$SQL = "SELECT count(*) AS x FROM my_security_table WHERE user = '$user_id' AND page = '$page' ";
// execute the query
if($db->f('x') > 0) {
echo "Access granted";
}else{
echo "Access denied";
}
The table will have a pages and users which can access them
my_security_table:
page
user
...
capisci ?
_________________
Melvyn Perez
Puro Codigo
http://purocodigo.com |
 |
 |
blasalle
Posts: 69
|
| Posted: 03/12/2010, 6:00 AM |
|
Melvyn, your suggestion and code are very similar to what I have in mind. Thank you very much!
I am going to to expand the function of the code and the content of the lookup table so that the can be a conditional response based on the data in the table and use the database table(s) to document when authorization status was changed for any page and/or object.
I will post the code when I'm done. Thanks again to you and Andy for your help with this.
bernie
_________________
Bernie
University of Utah
Salt Lake City, UT USA |
 |
 |
|