Here's the idea - I've got a Snitz intranet/client portal that runs completely 'Allowed Members Only Hidden' forums of which there are 50+ and growing. Employees are granted Moderator status and clients are Normal Users. This allows me an ease of flexibility in show/hide fucntions around the site.
Anyway, it is becoming a pain when we have a new employee start where we have to grant access to say 40 of the 50+ forums AND give them moderator access to these areas.
I've done a bit of code that grants FULL access to all of the forums and grants moderator privileges to all of them too. Reason being it is easier to then manually prune the say 10 forum access away from that user. Here is the code:
Dim EMP
EMP = ChkString(Request.QueryString("recid"),"SQLString")
Dim strSql, conn
Set conn = Server.CreateObject("ADODB.Connection")
conn.Open strConnString
strSql = " DELETE FROM FORUM_ALLOWED_MEMBERS WHERE MEMBER_ID ="&EMP&" "
conn.Execute strSql
strSql = " DELETE FROM FORUM_MODERATOR WHERE MEMBER_ID ="&EMP&" "
conn.Execute strSql
strSql = " SELECT FORUM_ID INTO FORUM_TEMP2 FROM FORUM_FORUM WHERE F_PRIVATEFORUMS=6 "
conn.Execute strSql
strSql = " SELECT FORUM_ID INTO FORUM_TEMP3 FROM FORUM_FORUM WHERE F_PRIVATEFORUMS=6 AND CAT_ID=2 "
conn.Execute strSql
strSql = " ALTER TABLE FORUM_TEMP2 ADD MEMBER_ID INT"
conn.Execute strSql
strSql = " ALTER TABLE FORUM_TEMP3 ADD MEMBER_ID INT"
conn.Execute strSql
strSql = " UPDATE FORUM_TEMP2 SET MEMBER_ID = "&EMP&" "
conn.Execute strSql
strSql = " UPDATE FORUM_TEMP3 SET MEMBER_ID = "&EMP&" "
conn.Execute strSql
strSql = " INSERT INTO FORUM_ALLOWED_MEMBERS (MEMBER_ID, FORUM_ID) SELECT MEMBER_ID, FORUM_ID FROM FORUM_TEMP2 "
conn.Execute strSql
strSql = " INSERT INTO FORUM_MODERATOR (FORUM_ID, MEMBER_ID, MOD_TYPE) SELECT FORUM_ID, "&EMP&", 0 FROM FORUM_TEMP3 "
conn.Execute strSql
strSql = " DROP TABLE FORUM_TEMP2 "
conn.Execute strSql
strSql = " DROP TABLE FORUM_TEMP3 "
conn.Execute strSql
conn.Close
I've got this in a page that I link from within pop_profile.asp.
What I am thinking is that I've been playing around with some very nice Ajax forms of late (as a User) that could possibly allow me to do this for all employees on one page. I'm visualizing a column of User Names (moderators) on left side of the page and Forum Names on right side. By mouseover of the username the Forum Names of the forums that they have access privs and moderator privs become highlighted. By dragging the username across to the forum name it does the SQL updates as above but for a single forum. Ideally I'd have an All forums tag too.
Now, I have no experience with Ajax or jscript and would be interested in any pointers in how I could buiid this page.
Maybe it could be done in jscript/css alone .. I don't know but would appreciate your thoughts.<