CodeCharge Studio
search Register Login  

Web Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> ASP

 Admin Data View for all user in Restricted Grid

Print topic Send  topic

Author Message
janiali

Posts: 44
Posted: 11/28/2007, 5:55 AM

Hi ,

I am new to this fourm . I have two question one is I am useing a Login Restricted Data Grid with "userID=userID(session) so the question is how admin will be able to see all the user data in that same grid .

Question nubmer 2 .

I have one application just for data entry .
the data flow is ( Region then , Program, then Activity type then , Aticity ,)

what I want is once a user will login to application he should be restricted to his Region . and if he will select any program there will be only activities belong to that program and if he will select activity type there will be only those activities related to that activity type .

for examlp

we have 4 regions 1,2,3,4
we have 3 Program P1,P2,P3
we have 3 types of activities A1,A2,A3
We have 100 Acitvities belong to each Activity type each Program Each Region .

there are 2 or 3 users in every region .

what I want is once a user from any region will login he should be able to see only his data and he should be able to insert data in only his region . and then when he will select activity type there will be only activites available those belong to that type .

can some one help for this
I have a table for Activitytypes one for Activities one for Users one for Regions one for PRograms . I have created relationship every where needed .

Please help me in this
thanks

_________________
Jani Ali
View profile  Send private message
Oper


Posts: 1195
Posted: 11/28/2007, 7:19 PM

dirty solution casue i dont know excatly your others posible expresion parameters
but this will give you a hint.

on before Form Build Select:

'========= IF ADMIN GROUP
if ccgetgroupID() = 90 then
Form.datasource.where = Form.datasource.where & " OR (userid > 0) "
End If

note: change userid=userid(session)
for
userid = ccgetuserid() (expresion) <-- Healthy
_________________
____________________________
http://www.7bz.com (Free CMS,CRM Developed in CCS)

http://www.PremiumWebTemplate.com
Affiliation Web Site Templates

Please do backup first
View profile  Send private message
janiali

Posts: 44
Posted: 12/03/2007, 12:09 PM

Hi thanks for the help I am still not able to get it done .
I am useing one Grid to restric that on the same page I have add/edit form as well where I am useing ccgetuserid and on the same page this grid is only showing the data for loged in user I want Admin to see all users Data . Please help
thanks


Quote Oper:
dirty solution casue i dont know excatly your others posible expresion parameters
but this will give you a hint.

on before Form Build Select:

'========= IF ADMIN GROUP
if ccgetgroupID() = 90 then
Form.datasource.where = Form.datasource.where & " OR (userid > 0) "
End If

note: change userid=userid(session)
for
userid = ccgetuserid() (expresion) <-- Healthy

_________________
Jani Ali
View profile  Send private message
Oper


Posts: 1195
Posted: 12/05/2007, 4:58 AM

did you try the on before build select suggested?

do you know the group number of the Admin?
_________________
____________________________
http://www.7bz.com (Free CMS,CRM Developed in CCS)

http://www.PremiumWebTemplate.com
Affiliation Web Site Templates

Please do backup first
View profile  Send private message
janiali

Posts: 44
Posted: 12/05/2007, 9:19 PM

Quote Oper:
did you try the on before build select suggested?

do you know the group number of the Admin?

yes I have 4 groups and I want group 3 and 4 should be able to see the all data in the grid group 4 is for admin and group 3 is for Manager .
I have useing ccgetuserID() but its restricting all the data . and showing only session user data . please specify the above mention =====If Admin Group code in detail .
thanks
I am totally new in ASP so I need the exact code for admin group .
thanks
jani

_________________
Jani Ali
View profile  Send private message
wkempees
Posted: 12/06/2007, 5:34 AM

CCGetGroupID Function (ASP)
Description
Retrieves the security group ID value of the currently logged in user.

Syntax
CCGetGroupID()Return Value
Integer

Walter

"janiali" <janiali@forum.codecharge> schreef in bericht
news:64757864a9a21b@news.codecharge.com...
>
Quote Oper:
> did you try the on before build select suggested?
>
> do you know the group number of the Admin?
>
>
> yes I have 4 groups and I want group 3 and 4 should be able to see the all
> data
> in the grid group 4 is for admin and group 3 is for Manager .
> I have useing ccgetuserID() but its restricting all the data . and showing
> only
> session user data . please specify the above mention =====If Admin Group
> code in
> detail .
> thanks
> I am totally new in ASP so I need the exact code for admin group .
> thanks
> jani
>
> _________________
> Jani Ali
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.yessoftware.com/
>

janiali

Posts: 44
Posted: 12/06/2007, 7:19 AM


Quote wkempees:
CCGetGroupID Function (ASP)
Description
Retrieves the security group ID value of the currently logged in user.

Syntax
CCGetGroupID()Return Value
Integer

Walter

"janiali" <janiali@forum.codecharge> schreef in bericht
news:64757864a9a21b@news.codecharge.com...
>
Quote Oper:
> did you try the on before build select suggested?
>
> do you know the group number of the Admin?
>
>
> yes I have 4 groups and I want group 3 and 4 should be able to see the all
> data
> in the grid group 4 is for admin and group 3 is for Manager .
> I have useing ccgetuserID() but its restricting all the data . and showing
> only
> session user data . please specify the above mention =====If Admin Group
> code in
> detail .
> thanks
> I am totally new in ASP so I need the exact code for admin group .
> thanks
> jani
>
> _________________
> Jani Ali
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.yessoftware.com/
>


I am trying in DataSource where filed is User.regionID = CCgetGroupID() and default value 4 can you please tell me where I have to put this CCget group ID .
I am totally confused

thanks
Jani

_________________
Jani Ali
View profile  Send private message
Oper


Posts: 1195
Posted: 12/06/2007, 1:09 PM

again the solution shoudl be this:

if ccgetgroupID() >= 3 then
Form.datasource.where = Form.datasource.where & " OR (userid > 0) "
End If

note: change userid=userid(session)
for
userid = ccgetuserid() (expresion) <-- Healthy

Could please copy and paste here you Custom Code (the part where you use the On Before build Pls.
_________________
____________________________
http://www.7bz.com (Free CMS,CRM Developed in CCS)

http://www.PremiumWebTemplate.com
Affiliation Web Site Templates

Please do backup first
View profile  Send private message
janiali

Posts: 44
Posted: 12/06/2007, 10:48 PM

Quote Oper:
again the solution shoudl be this:

if ccgetgroupID() >= 3 then
Form.datasource.where = Form.datasource.where & " OR (userid > 0) "
End If

note: change userid=userid(session)
for
userid = ccgetuserid() (expresion) <-- Healthy

Could please copy and paste here you Custom Code (the part where you use the On Before build Pls.

I am useing this code there now
if ccgetgroupID() >= 3 then
tblpip_list.tblpip.pipID = tblpip_list.tblpip.pipID & " OR (userid > 0) "
End If

but it give me error as I am again totally confused about Datasource and where ?
tblpip_list is my form and tblPIP is my datasource and pipID is that one field in that grid .

actully I have these fields in that grid
PIPID , Username, ProgramName,RegionName,ActivityName,Male,Femal,Numbers,Date .
and the above fields and comming from different table like
tblPIP,tbluser,tblProgram,tblregion,tblActivity,
so can you please mention what I should use and where ?
as I am confused about form ? DataSource? and where ?
now all the database is front of you can you please write the full code for me
as I am bothring you too much because I am totally new in this programing

thanks
Jani

_________________
Jani Ali
View profile  Send private message
wkempees
Posted: 12/07/2007, 4:50 AM


In the DataSource it is
GroupID
type Session


"janiali" <janiali@forum.codecharge> schreef in bericht
news:64758ecb3607b6@news.codecharge.com...
>
Quote Oper:
> again the solution shoudl be this:
>
> if ccgetgroupID() >= 3 then
> Form.datasource.where = Form.datasource.where & " OR (userid > 0) "
> End If
>
> note: change userid=userid(session)
> for
> userid = ccgetuserid() (expresion) <-- Healthy
>
> Could please copy and paste here you Custom Code (the part where you use
> the On
> Before build Pls.
>
>
> I am useing this code there now
> if ccgetgroupID() >= 3 then
> tblpip_list.tblpip.pipID = tblpip_list.tblpip.pipID & " OR (userid > 0) "
> End If
>
> but it give me error as I am again totally confused about Datasource and
> where
> ?
> tblpip_list is my form and tblPIP is my datasource and pipID is that one
> field
> in that grid .
>
> actully I have these fields in that grid
> PIPID , Username,
> ProgramName,RegionName,ActivityName,Male,Femal,Numbers,Date .
>
> and the above fields and comming from different table like
> tblPIP,tbluser,tblProgram,tblregion,tblActivity,
> so can you please mention what I should use and where ?
> as I am confused about form ? DataSource? and where ?
> now all the database is front of you can you please write the full code
> for me
>
> as I am bothring you too much because I am totally new in this programing
>
> thanks
> Jani
>
> _________________
> Jani Ali
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.yessoftware.com/
>

janiali

Posts: 44
Posted: 12/07/2007, 6:00 AM

Hi thanks for the help but still its not getting through .
I am using the below code on event before build

'Custom Code @85-73254650
' -------------------------
'if ccgetgroupID() >= 3 then
'tblpip_list.tblrole.roleid = tblpip_list.tblrole.roleID & " OR (userID > 0) "
'End If
' -------------------------
'End Custom Code

I have in Visua query userID=ccgetuserID() Expression
and I have tbluser.roleID=ccgetgroupID() Session

it is show me only admin related data not all the data and the rest no user is able to see even his own data .
Please help me in all this as I am totally struck with so many issue in CCS this is one of them
I am getting reply very late as every body is busy .
I have my msn ID if some one can help me online
my MSN ID isimran.itrc@gmail.com
Please help
thanks
Jani

_________________
Jani Ali
View profile  Send private message
Oper


Posts: 1195
Posted: 12/09/2007, 8:19 AM

we willd doit.

* what is the filedname where you store the name of the Userid?

* What the name of the form?

* What number group are admin?



i will try to writedown the exact code you need.
_________________
____________________________
http://www.7bz.com (Free CMS,CRM Developed in CCS)

http://www.PremiumWebTemplate.com
Affiliation Web Site Templates

Please do backup first
View profile  Send private message
janiali

Posts: 44
Posted: 12/09/2007, 11:10 AM

Quote Oper:
we willd doit.

* what is the filedname where you store the name of the Userid?

* What the name of the form?

* What number group are admin?

i will try to writedown the exact code you need.


Thanks for the help Oper

I have one table called tbluser in that table I have userID, RoleID,Username,password
then I have one tblRole table there I have RoleID,RoleName

I have tblpip_list.asp where I have one search form one Add/Edit form and one DataGrid
I want that data grid to be use by Admin for all users Data and the rest all user can see thier own data only .
Admin Group number is 4

thanks a lot for this great effort to teach like me Dumb .....

_________________
Jani Ali
View profile  Send private message
Oper


Posts: 1195
Posted: 12/09/2007, 1:01 PM

Name of the add/edit formand name of the datagrid form??


_________________
____________________________
http://www.7bz.com (Free CMS,CRM Developed in CCS)

http://www.PremiumWebTemplate.com
Affiliation Web Site Templates

Please do backup first
View profile  Send private message
janiali

Posts: 44
Posted: 12/09/2007, 1:35 PM

Quote Oper:
Name of the add/edit formand name of the datagrid form??



tblpip is the name of Grid Form and tblpip1 is the name of Add Edit Form and tblpipsearch is the name of search form .
these are the all three form on tblpip_list.asp page .

Thanks for the quick responce
Jani

_________________
Jani Ali
View profile  Send private message
Oper


Posts: 1195
Posted: 12/09/2007, 2:09 PM

on before Form Build Select:

'========= IF ADMIN GROUP
if ccgetgroupID() = 4 then
tblpip.datasource.where = Form.datasource.where & " OR (UserID > 0) "
End If

just add this to the before build select of the grid tblpip (Without modification)
(This should fix first part let me know)

copy paste any error you may have here

_________________
____________________________
http://www.7bz.com (Free CMS,CRM Developed in CCS)

http://www.PremiumWebTemplate.com
Affiliation Web Site Templates

Please do backup first
View profile  Send private message
janiali

Posts: 44
Posted: 12/09/2007, 2:24 PM

Quote Oper:
on before Form Build Select:

'========= IF ADMIN GROUP
if ccgetgroupID() = 4 then
tblpip.datasource.where = Form.datasource.where & " OR (UserID > 0) "
End If

just add this to the before build select of the grid tblpip (Without modification)
(This should fix first part let me know)

copy paste any error you may have here


Hi I used the above mention code as it is . and gives me this error

Microsoft VBScript runtime error '800a01f4'
Variable is undefined: 'Form'
/ims/tblPIP_list_events.asp, line 24

Please check the code again you have not mention any thing in the code like fom name and data source and where ?

Please recheck
thanks
JAni

_________________
Jani Ali
View profile  Send private message
Oper


Posts: 1195
Posted: 12/09/2007, 6:54 PM

sorry my bad

should be:
  
'========= IF ADMIN GROUP  
if ccgetgroupID() = 4 then  
   tblpip.datasource.where = tblpip.datasource.where & " OR (UserID > 0) "  
End If  

_________________
____________________________
http://www.7bz.com (Free CMS,CRM Developed in CCS)

http://www.PremiumWebTemplate.com
Affiliation Web Site Templates

Please do backup first
View profile  Send private message
janiali

Posts: 44
Posted: 12/09/2007, 11:01 PM

Quote Oper:
sorry my bad

should be:
  
'========= IF ADMIN GROUP  
if ccgetgroupID() = 4 then  
   tblpip.datasource.where = tblpip.datasource.where & " OR (UserID > 0) "  
End If  


Hi I put the above code and it give me this error on the page

Form: Grid tblPIP
Error: Incorrect syntax near the keyword 'OR'. (Microsoft OLE DB Provider for SQL Server)

I can see the Add Edit form and Search Form but grid is not there

Please let me know what could be the problem
thank
Jani

_________________
Jani Ali
View profile  Send private message
Oper


Posts: 1195
Posted: 12/10/2007, 3:22 AM


tblpip grid has this already right:
userid = ccgetuserid() (expresion)
?

could you add this to the code to DEBUG:

    
'========= IF ADMIN GROUP    
if ccgetgroupID() = 4 then    
   tblpip.datasource.where = tblpip.datasource.where & " OR (UserID > 0) "    
   response.write "DEBUG:" & tblpip.datasource.where  
End If    



_________________
____________________________
http://www.7bz.com (Free CMS,CRM Developed in CCS)

http://www.PremiumWebTemplate.com
Affiliation Web Site Templates

Please do backup first
View profile  Send private message
janiali

Posts: 44
Posted: 12/10/2007, 3:45 AM

Quote Oper:

tblpip grid has this already right:
userid = ccgetuserid() (expresion)
?

could you add this to the code to DEBUG:

    
'========= IF ADMIN GROUP    
if ccgetgroupID() = 4 then    
   tblpip.datasource.where = tblpip.datasource.where & " OR (UserID > 0) "    
   response.write "DEBUG:" & tblpip.datasource.where  
End If    

Yes tblPIP grid has userid=ccgetgroupid() (expresion)

now I have same error with Debug
DEBUG: OR (UserID > 0) OR (UserID > 0)

thanks



_________________
Jani Ali
View profile  Send private message
janiali

Posts: 44
Posted: 12/10/2007, 3:49 AM

Quote janiali:
Quote Oper:

tblpip grid has this already right:
userid = ccgetuserid() (expresion)
?

could you add this to the code to DEBUG:

    
'========= IF ADMIN GROUP    
if ccgetgroupID() = 4 then    
   tblpip.datasource.where = tblpip.datasource.where & " OR (UserID > 0) "    
   response.write "DEBUG:" & tblpip.datasource.where  
End If    

Yes tblPIP grid has userid=ccgetgroupid() (expresion)

now I have same error with Debug
DEBUG: OR (UserID > 0) OR (UserID > 0)

thanks



sorry
userid=ccgetuserid() (expresion)
is there
thanks
Jani

_________________
Jani Ali
View profile  Send private message
Oper


Posts: 1195
Posted: 12/10/2007, 4:07 AM

could you take a snapshot of the grid selection

where you put the :
userid = ccgetuserid() (expresion)

odd part is look like the code is duplicated. DEBUG: OR (UserID > 0) OR (UserID > 0)

_________________
____________________________
http://www.7bz.com (Free CMS,CRM Developed in CCS)

http://www.PremiumWebTemplate.com
Affiliation Web Site Templates

Please do backup first
View profile  Send private message
janiali

Posts: 44
Posted: 12/10/2007, 4:39 AM

Quote Oper:
could you take a snapshot of the grid selection

where you put the :
userid = ccgetuserid() (expresion)

odd part is look like the code is duplicated. DEBUG: OR (UserID > 0) OR (UserID > 0)


ok now I have removed the duplicate code now the error is same with Debug
DEBUG: OR (UserID > 0

I have uploaded that application on this link please you can have a look

DataEntry is the link for that Grid
http://hdf.com.pk/ims/tblpip_list.asp

user name for normal user is test and password is also test and Admin user name is Admin and password is jani .
Please do something
if you want I can send you the complete code of this application but please give me your email address .
thanks
Jani

_________________
Jani Ali
View profile  Send private message
Oper


Posts: 1195
Posted: 12/10/2007, 6:55 AM

the application on that link do not work.

few more question:

1) are you useing user = ccgetuserid() or user=session("userid")?
2) try this code so we could display a litle more debug:

  
'========= IF ADMIN GROUP      
if ccgetgroupID() = 4 then      
   tblpip.datasource.where = tblpip.datasource.where & " OR (UserID > 0) "      
   response.write "DEBUG:" & tblpip.datasource.where    
   response.write "<br>DEBUG2:" & ccgetuserid() & ccgetuserlogin()  
End If      
we are close. )

if you are learinng we could stay here dont worry we would doit. on this thread
if in a rush i could check the project

but i prefer doit in the forum cuase everyone could learn and fix in the future

copy paste again the new info/error and display you get.

i will be online like 3 more hour



_________________
____________________________
http://www.7bz.com (Free CMS,CRM Developed in CCS)

http://www.PremiumWebTemplate.com
Affiliation Web Site Templates

Please do backup first
View profile  Send private message
Oper


Posts: 1195
Posted: 12/10/2007, 7:11 AM

application is working. i see

this was added to the before build select to the grid on the bottom?
userid = ccgetuserid() (expresion) looks like is not.
_________________
____________________________
http://www.7bz.com (Free CMS,CRM Developed in CCS)

http://www.PremiumWebTemplate.com
Affiliation Web Site Templates

Please do backup first
View profile  Send private message
janiali

Posts: 44
Posted: 12/10/2007, 7:17 AM

Quote Oper:
the application on that link do not work.

few more question:

1) are you useing user = ccgetuserid() or user=session("userid")?
2) try this code so we could display a litle more debug:

  
'========= IF ADMIN GROUP      
if ccgetgroupID() = 4 then      
   tblpip.datasource.where = tblpip.datasource.where & " OR (UserID > 0) "      
   response.write "DEBUG:" & tblpip.datasource.where    
   response.write "<br>DEBUG2:" & ccgetuserid() & ccgetuserlogin()  
End If      
we are close. )

if you are learinng we could stay here dont worry we would doit. on this thread
if in a rush i could check the project

but i prefer doit in the forum cuase everyone could learn and fix in the future

copy paste again the new info/error and display you get.

i will be online like 3 more hour




Thanks for the help now the error is
DEBUG: OR (UserID > 0)
DEBUG2:9admin

thanks
Jani


_________________
Jani Ali
View profile  Send private message
janiali

Posts: 44
Posted: 12/10/2007, 7:20 AM

Quote Oper:
application is working. i see

this was added to the before build select to the grid on the bottom?
userid = ccgetuserid() (expresion) looks like is not.

Yes you are right
the Grid is on the bottom of that page and I am using userID= ccgetuserID() (expresion )

I am online too
I am greatfull for help
it looks like we need to put some group ID where we are using (userID>0)

I don't know just guessing .
thanks
Jani

_________________
Jani Ali
View profile  Send private message
Oper


Posts: 1195
Posted: 12/10/2007, 7:28 AM

5 min to test somthing on my side
_________________
____________________________
http://www.7bz.com (Free CMS,CRM Developed in CCS)

http://www.PremiumWebTemplate.com
Affiliation Web Site Templates

Please do backup first
View profile  Send private message
Oper


Posts: 1195
Posted: 12/10/2007, 8:47 AM

ok sorry the code shoudl be like thsi to be safe:
i read your PM
  
if ccgetgroupID() = 4 then        
   tblpip.datasource.where =  " (UserID > 0) "        
else  
    tblpip.datasource.where = " UserID =  "     & ccgetuserid()  
End If   


1 line coudl be commented but let keepit that way
just dont use the: userid = ccgetuserid() (expresion)
we are going dinamic for your others stuff
_________________
____________________________
http://www.7bz.com (Free CMS,CRM Developed in CCS)

http://www.PremiumWebTemplate.com
Affiliation Web Site Templates

Please do backup first
View profile  Send private message
 Page 1 of 2  Next Last


Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

PHP Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.