Gossamer Forum
Home : Products : DBMan : Customization :

Two Quick Questions

Quote Reply
Two Quick Questions
Two Quick Questions For Anyone Who Can Help :)

1) Is there a way to only allow choices to be given to certain users, based upon their user name? For example, is there a way I could specify that only specific user ID's can access the Admin (User Management) Screen? The reason I am asking, is that we will have quite a few people with Admin permissions - (and need that access to see certain fields, do record modifications, and validations, etc), yet I do not wish but for a limited few to be able to access that certain part of the script.

Is there any way to code this similarly to the "if ($per_admin)", and somehow have a list in the .cfg file, that references the userid's of who is authorized to have that choice?


2) I need to have a way to integrate a second copy of the validate script, without causing conflicts with the first one. The Record Administrator for the county will validate it as being accurate (via the first validator), and the State Administration will (hopefully), use a second version of the validate script, to validate the record and tag it as such. This would make sure that all records have been viewed, and approved by both people. This second script would only be accessible to the State Administrator (hopefully via the above script as well).

Has anyone successfully integrated two versions of the validate module? If so, what modifications/renamings must be done? If not, any ideas?


I appreciate your help - Thanks In Advance!


Chris Kinsler, K4CGK
Assistant Emergency Coordinator, Hanover/Henrico County ARES/RACES
Webmaster, Commonwealth of Virginia ARES/RACES - http://www.aresva.org


Quote Reply
Re: Two Quick Questions In reply to
1) Unless I'm not understanding the question. You should be able to just assign admin rights to those you wish to use the admin features.

2) I would think that you could create approval fields which are only viewable by admin. The person who would be validating the record so it could be seen by others would first want to be sure the first approval field has been checked or whatever, and then they could use the actual validation field to make the record available for viewing.

I hope that made sense Smile Are you using the validation field to approve a record prior to having it display to users? If so, I myself would only want one field to do this.

Hope this helps and doesn't confuse the issue.

Unoffical DBMan FAQ
http://webmagic.hypermart.net/dbman/
Quote Reply
Re: Two Quick Questions In reply to
In Reply To:
Unless I'm not understanding the question. You should be able to just assign admin rights to those you wish to use the admin features.
That's my problem - these people already will have admin rights. They are part of the county-level staff that will be searching, modifying, deleting, and county-level validating the other MEMBER's records. To do all of this, they need Admin rights.

But what I need is to be able to NOT show them the Admin spot (For User Management), and only allow this to be shown to certain user_ids (like myself). I don't want them in there tinkering with other users passwords, and permissions -- as I should be the only one doing that.


In Reply To:
I would think that you could create approval fields which are only viewable by admin. The person who would be validating the record so it could be seen by others would first want to be sure the first approval field has been checked or whatever, and then they could use the actual validation field to make the record available for viewing.
I already have the validation module in place for one set of fields (county level validation). I need to impliment a second level of validation (hopefully using a copy of the same script, modified somehow), in order to allow the STATE administrator to approve the record. The state admin has to validate/approve the record, before they are technically considered a member (and gain legal protection, etc). As such, this SECOND validation module & field should only be accessible by the State Admin.

I think we confused the issue a little bit - Sorry if I didn't explain my purpose well enough. Smile

Maybe this helped a little?


Chris Kinsler, K4CGK
Assistant Emergency Coordinator, Hanover/Henrico County ARES/RACES
Webmaster, Commonwealth of Virginia ARES/RACES - http://www.aresva.org



Quote Reply
Re: Two Quick Questions In reply to
For your first question, I think the easiest option would be to add another level of permission to your database. The Validate mod is based on having "admin" permissions, so rather than changing each occurance of this is the script, you could add a new level called "superadmin" (for example), then change your database such that only the "superadmin" can edit the user accounts.

A resource for adding permissions can be foud here:
http://www.jpdeni.com/...ds/AddPermission.txt

I'm not that familiar with the validate mod, having not used it before, so I can't help with your second question... But hopefully I've been able to help out with the first one Smile

- Mark

Astro-Boy!!
http://www.zip.com.au/~astroboy/
Quote Reply
Re: Two Quick Questions In reply to
Mark's suggestion of using the "Add Permission" mod is right on. That's what I would have suggested.

I'm not quite sure I understand your question about validating. You want records to be validated twice?


JPD
http://www.jpdeni.com/dbman/
Quote Reply
Re: Two Quick Questions In reply to
Is there an alternative way of specifying something like if $db_userid = "Jdoe" then print the "Admin" choice (the user management). If this could be done, this would allow all of the people with admin access to show the full admin line, except for that choice. Whereas A person with that certain user ID (or list of ID's somehow), would get that choice in addition to the full admin line.

Is it possible to code it this way - on a user name basis?

In Reply To:
I'm not quite sure I understand your question about validating. You want records to be validated twice?
Ok - I'll start from the top and maybe I can be a little more clear this time Smile

When a potential member logs in to the database, they are forced to add a new record. This record is flagged as not being validated, and is emailed to the county level administrator (based on county specified in the record), the district level (based on where the county resides), area level (based on where the district resides), and finally state level. This allows all the proper admins to be notified, and for any of them to be able to validate the record as being accurate.

This portion of the script works - All thanks to JP's wonderful help!

Soo...my next step is to somehow have another step of validation, that the state admin (and ONLY him) must perform to the record. The law, and various agreements with the state/federal officials (VA Dept of Emergency Services, FEMA, etc.) require that the state section manager (admin) must "sign off" on the records in the database, thereby approving them - before they are truly considered members of VA ARES/RACES. Membership gives them legal protection under the Volunteer Protection Act, and a couple of other things, which are very important.

I will tell you what I would like to see, and you guys can hopefully tell me if it can be done:

The validation process for county level, and everything in the first paragraph will stay the same. County/District or Area level admins will still continue to receive the validation requests. They will process them, and the current validation module will tag the record as being validated. I would like to have a choice shown only to the State Section Manager (through the user-id match, if possible) that would allow him to use a SECOND copy of the validate routine, and would tag another set of fields as "SM_Verified" and date/time. This would allow only HIM to "sign off" on the records.

The canned validate mod would work perfect for this second use, but I would have to figure out two things:
1) It would only have to be visible to him
2) It can't interfere with the one that's already installed.

JP - Any Ideas?

Thanks,

Chris Kinsler, K4CGK
Assistant Emergency Coordinator, Hanover/Henrico County ARES/RACES
Webmaster, Commonwealth of Virginia ARES/RACES - http://www.aresva.org


Quote Reply
Re: Two Quick Questions In reply to
Sure. You can code for individual names. But you wouldn't want to do it for very many names, because it would get complicated.

If you just wanted one person to have specific permissions, you could change every instance of that permission to if ($db_userid eq "JoeBlow"). You would need to change it in both sub html_footer and in db.cgi, sub main.

Regarding your validation -- You might be able to do it with another field or two.

If you just need the county person to validate and then the state person, you could add a field -- CountyOK -- with options "Yes" and "No." The county person would search for
Validated=No
CountyOK=No

He/she would change CountyOK to "Yes" but leave Validated alone. (We can probably work out permissions things so they don't validate what they're not supposed to.)

The state person would then come in and look for
Validated=No
CountyOk=Yes

He/she would then change the "Validated" field to "Yes" -- or not. Smile

This is all off the top of my head, but it seems that it would be the best way to go. The only other way I can think of would be to have the new or modified records go to a new file for the county person to validate and then go to another new file for the state person to validate and then go to the database file.

JPD
http://www.jpdeni.com/dbman/
Quote Reply
Re: Two Quick Questions In reply to
As Always JP - Thanks for the quick reply. I hope you had a great 4th!

In Reply To:
If you just wanted one person to have specific permissions, you could change every instance of that permission to if ($db_userid eq "JoeBlow"). You would need to change it in both sub html_footer and in db.cgi, sub main.
GREAT! I agree, this would probably become cumbersome for more than a few users - but at max it would be used for 3. Which brings me to ask, How can this be coded to compare to see if it is "User1", "User2", or "User3", instead of just "User1"?

In Reply To:
Regarding your validation -- You might be able to do it with another field or two.
I hadn't even thought of doing it that way. The state admin (via user id verification above), could have a text link that would search for those CountyOk=Yes, and Validated=No. Then he could utilize the Validation Module, and have it email the user the Success Message.

The one problem that I could forsee, is there is no way that we would know who validated the county level, and when. Right now, since they are using the validation script-it changes the field to Yes, and adds the date and userid of the person validating it. If we changed the process of the county level, to manually change the County_Ok field to Yes, we lose the audit of who did this valiation and when (Since it would not be utilizing the validation script anymore).

We need to have some sort of audit trail in the record as to when and who validated the county level. And when and who validated the state level (There are two people who can do this). The script, as it is, would handle this for one or the other, but not both. This is why I had originally thought to integrate two copies of the module somehow. I don't know how this could be done.

Any Ideas?


Chris Kinsler, K4CGK
Assistant Emergency Coordinator, Hanover/Henrico County ARES/RACES
Webmaster, Commonwealth of Virginia ARES/RACES - http://www.aresva.org

Quote Reply
Re: Two Quick Questions In reply to
(The 4th wasn't bad. I felt like I was in a war zone most of the day, though. Smile Hope yours was good!)

For multiple users, it would be

if (($db_userid eq 'User1') or ($db_userid eq 'User2') or ($db_userid eq 'User3'))

I think you're going to need something more than the validate script that is there now. Let me do some pondering and I'll get back to you.

JPD
http://www.jpdeni.com/dbman/
Quote Reply
Re: Two Quick Questions In reply to
In Reply To:
(The 4th wasn't bad. I felt like I was in a war zone most of the day, though. Hope yours was good!)
Well - mine was...well, interesting Smile

In Reply To:
I think you're going to need something more than the validate script that is there now. Let me do some pondering and I'll get back to you.
Not a problem JP - Thanks for all of the help. I've gone back and read my previous posts, and rather than edit them, I figure I'll just recap what I need -- hopefully this will clarify things, and give you a better idea.


When a potential member adds his/her record, an email is generated to the County Level Admin (EC), the District Level Admin (DEC), Area Level Admin (ASEC), and State Admins (SEC and SM). These emails are part of the html_add_success and html_modify_success. This part works great Smile

When any of the Admins logon, they can search via a popup choice in the footer, for the county they wish to validate. The script searches for any records that have NO in the validate field. The script acts as normal, and of course, allows the admin to validate/delete the record, and if validated - Changes the Validate field to Yes, and adds the &get_date to a Validate_Date field, and the User id To a "Validated_By" field. This also works VERY well Smile

This is where I need the next help:
One of the State Admins (Either the SM or SEC), need to have a link at the bottom of the admin screen, that is visible only to them. This will be possible due to the "if (($db_userid eq 'User1') or ($db_userid eq 'User2'))". When clicked, the link will search for all records that have No in a State Validation Field. The Admin then will review the information, and approve or delete it. When approved, it will change this field to Yes, and email the user accordingly.

In essence, the State admin will be using the standard Canned Validation script. I just need a way to impliment a *SECOND* copy into my coding, and reference it accordingly. I know this would work, i just need to make sure it doesn't conflict with the first copy (County level).

Maybe this will clarify things a little bit more Smile. My main question is: Can a second copy of the validate module be put in the coding? If yes, What things need to be changed to keep it from conflicting with the originial copy?

Thanks Again JP!

Chris Kinsler, K4CGK
Assistant Emergency Coordinator, Hanover/Henrico County ARES/RACES
Webmaster, Commonwealth Of Virginia ARES/RACES - http://www.aresva.org


Quote Reply
Re: Two Quick Questions In reply to
Ya know, I just thought of something. (The recap helped a lot!!! Smile)

You could just add one field -- StateValidated -- which would mean that all of your other stuff would be exactly the same. (No point in fixing what ain't broke!!!!)

And, yes, you would be able to just put in the same subroutines as with the validate mod. Name them sub state_validate and sub html_state_validate_form -- I'm sure you'll get the picture. The script would look for

Validated=Yes
StateValidated=No

Let me know if you have any trouble figuring things out -- what needs to be copied, what needs to be changed and such.

One thing you might not think of is in sub validate_records, after

$rec{$db_validated_field} = "Yes";

add

$rec{StateValidated} = "No";

Since that subroutine is just for the county folks, we'll make sure they can't change the state field.

The rest is pretty straightforward, but if you run into problems, don't hesitate to ask.

JPD
http://www.jpdeni.com/dbman/
Quote Reply
Re: Two Quick Questions In reply to
In Reply To:
Let me know if you have any trouble figuring things out -- what needs to be copied, what needs to be changed and such.
Ok - So here's where I show my ignorance Blush.

I have no clue as to what needs copied, changed, or integrated into the current files. I have created three new fields, and have them referenced as:

$db_state_validated_field = 'Validated_State';
$db_state_valdate_field = 'Validated_State_Date';
$db_state_valuser_field = 'Validated_State_By';


The Validated_State is the Yes/No. The Validated_State_Date of course, is the auto-entered date when the state validation takes place. And the Validated_State_By, is the auto-entered user id of the admin performing state val.

What coding do I need to integrate, and what things in the code need changed?? Sorry for the dumb questions - but I'm still learning Smile

Thanks Again!

Chris Kinsler, K4CGK
Assistant Emergency Coordinator, Hanover/Henrico County ARES/RACES
Webmaster, Commonwealth of Virginia ARES/RACES - http://www.aresva.org


Quote Reply
Re: Two Quick Questions In reply to
That's okay. I wasn't sure how much you did understand and I didn't want to take the time if it wasn't necessary. I don't mind taking it if it *is* necessary, though. Smile

Add the following to sub main:

Code:

elsif ($in{'validate_state_form'}) { if ($per_admin) { &html_validate_state_form; } else { &html_unauth; } }
elsif ($in{'validate_state_records'}) { if ($per_admin) { &validate_state_records; } else { &html_unauth; } }
You'll probably want to change the $per_admin part to what we talked about before, so only your "state" people can do this.

In sub add record, add

(!$per_admin) and ($in{$db_state_validated_field} = "No");

This will go right below the similar line you added for the other validation field.

Add an identical line to sub modify_record.

In sub view_records, change

(!$per_admin) and ($in{$db_validated_field} = "Yes");

to

(!$per_admin) and ($in{$db_state_validated_field} = "Yes");

Copy sub validate_records and paste the copy back into db.cgi. Rename the new subroutine sub validate_state_records.

In the old subroutine -- sub validate_records -- make the change I mentioned above:

after

$rec{$db_validated_field} = "Yes";

add

$rec{$db_state_validated_field} = "No";

(You can either use a variable or the name of the field. I used the variable here just for consistency.)

In sub validate_state_records, change

$rec{$db_validated_field} = "Yes";

to

$rec{$db_state_validated_field} = "Yes";

and change the lines to write the userid and date into the correct fields.

I think I'm going to need to look at the code you have in the footer again so I can tell you how to have only one validating thing, depending on who the user is.

Enter your fields into sub html_record_form, just like you did for the other ones.

Copy sub html_validate_form and paste it back into html.pl. Rename the new subroutine to sub html_validate_state_form.

Change the first line of the new subroutine to

$in{$db_state_validated_field} = "No";

I think you might as well use the same validate success page.

Does this make any sense?

JPD
http://www.jpdeni.com/dbman/