Page 1 of 4 123 ... LastLast
Results 1 to 15 of 47

Thread: workgroup files

  1. #1
    Join Date
    Oct 2004
    Posts
    105

    Unanswered: workgroup files

    Hi all
    i have a problem
    i have a database to that i added a workgroupfile, i enterred a user and a user group that user has special permissions. Now i entered a second user who i gave different permissions to the database like he should be able to delete something but somehow the database does not let him do that,
    Does somebody know where there could be my mistake?
    the second problem is:
    i have a vb programme working with that database, is there any way how i can let the programme know what permissions the logged in user has?
    Thanks a lot

  2. #2
    Join Date
    Sep 2004
    Posts
    161
    With the Workgroup file two solutions to use it (A97) :

    - Make this wrkgrp file the default for Access by using WrkGrpAdministrator
    - Make this wrkgrp file the default for your database by using /wrkgrp in the shorcut

    To know the groupe of the connected user you can use :
    Code:
    Dim usr As User, grp As Group
    
    Set wsp = DBEngine.Workspaces(0)
    If Len(Trim(strUser)) = 0 Then
        strUser = CurrentUser
    End If
        ' Recupération du nom du groupe de l'utilisateur
    For Each grp In wsp.Groups
        For Each usr In grp.Users
            If usr.Name = strUser Then
                    Nom_groupe = grp.Name
            End If
        Next usr
    Next grp
    But do not forget that a user can belong to several groups...

  3. #3
    Join Date
    Oct 2004
    Posts
    105
    thank you i will try that


    i still have a problem with the user permissions
    i deletet all permissiones from user group then added 2 new user groups
    one i gave the permisisones to read data and update data
    the other i gave permission to read, update, insert and delete data, i added different users to those groups
    the users added to the first group have its restrictions and permissions work ok but the user to the second group can delete or insert only change and read
    does somebody know how i can change that?

  4. #4
    Join Date
    Oct 2004
    Posts
    105
    i tried to let my programme know which group in the workgroup file the logged in user belongs to with the code abouve but i keep getting errors on it

    could the reason be that im working with ADO? if thats the reason, does somebody know if there is a way i can do that in ADO then?
    Thank you so much

  5. #5
    Join Date
    Jan 2004
    Location
    Lancashire, UK
    Posts
    33
    Quote Originally Posted by justme:-)
    thank you i will try that


    i still have a problem with the user permissions
    i deletet all permissiones from user group then added 2 new user groups
    one i gave the permisisones to read data and update data
    the other i gave permission to read, update, insert and delete data, i added different users to those groups
    the users added to the first group have its restrictions and permissions work ok but the user to the second group can delete or insert only change and read
    does somebody know how i can change that?
    With regard to your security/permissions problem, check what permissions the Users group has. By default ALL users are members of this group, so removing all permissions for the group should help.

    I don't think there is any way to acccess the dbengine.workspace object using ADO, it is specific to Access. Try adding a reference to DAO to your project.

  6. #6
    Join Date
    Oct 2004
    Posts
    105
    >I don't think there is any way to acccess the dbengine.workspace object >using ADO, it is specific to Access. Try adding a reference to DAO to your >project.


    if i do that with the dao then, does that not get problems with ado?
    in the references there are 2 daos
    micrososft dao 2.5/3.51 Compatibility library
    and microsoft dao 3.51 Object library
    does it make a difference which one i use?

    Thanks

  7. #7
    Join Date
    Jan 2004
    Location
    Lancashire, UK
    Posts
    33
    Use the Microsoft DAO 3.51 Object Library.

    You may experience some problems with adding the DAO library. To help prevent these always declare your object variables as follows:

    Dim rs1 As ADODB.Recordset
    Dim rs2 As DAO.Recordset
    Dim wsp As DAO.Workspace
    etc.

    Have you sorted the permission problem out?

  8. #8
    Join Date
    Oct 2004
    Posts
    105
    Hi thank you i will try that
    yes the permission works now i have no idea why but it does now
    its not been the user group cause i put it of all the permissions earlier already and the problem was that my user had to less permissions than i gave him so i started doing the workgroupfile all over anew and now it suddenly works and i dont see that i made anything different than i did the first time but must have done somewhere anyway im happy i works

  9. #9
    Join Date
    Oct 2004
    Posts
    105
    i still have problems with that code
    i added the dao reference and my code looks like that
    Dim usr As User, grp As Group
    Dim wsp As DAO.Workspace
    Dim Nom_groupe As String


    Set wsp = DBEngine.Workspaces(0)
    If Len(Trim(struser)) = 0 Then
    struser = CurrentUser
    End If
    (it works great up to here struser contains the correct userid)

    For Each grp In wsp.Groups
    For Each usr In grp.Users
    If usr.Name = struser Then
    Nom_groupe = grp.Name
    End If
    Next usr
    Next grp

    in the next line (For Each grp In wsp.Groups) if i do it step by step then i see that grp = nothing
    that makes it to not do the for loop
    how can it be that grp is nothing? do i have to again enter the path were the workgroup file is? i already do that when the user loggs in to the database

    with
    Public Function OpenDB()
    'This function opens the connection to the database



    strpassw = strPassWord
    struser = strUserName

    'Setting the connection
    Set dbDBSAccessConn = New ADODB.Connection


    'choosing the driver for the connection
    dbDBSAccessConn.Provider = "Microsoft.Jet.OLEDB.4.0"

    'opens the connection
    'dbDBSAccessConn.Open (App.Path & "\database.mdb, ")
    dbDBSAccessConn.Properties("Jet OLEDBystem database") = App.Path & "\Workgroup.mdw"
    dbDBSAccessConn.Open App.Path & "\database.mdb", struser, strpassw


    thanks alot

  10. #10
    Join Date
    Jan 2004
    Location
    Lancashire, UK
    Posts
    33
    If you are running the code from Access, then what you have should work. If you are running it from outside of Access then you need to use the CreateWorkspace method. I can't remember how to use this, but I have found this link which may help:

    http://www.vbcity.com/forums/topic.a...reateworkspace

    Scroll down to the 6th post, from qz. Sorry I can't be of anymore help than that.

  11. #11
    Join Date
    Oct 2004
    Posts
    105
    I will look at that
    thanks so much for your help

  12. #12
    Join Date
    Oct 2004
    Posts
    105
    me again
    is it possible that the above code is not working because i open the database with ado?
    do i have to in order to get the groups to open the database again with dao?
    or does that have nothing to do with that?
    or do i need something like
    "Set grp = wsp.Groups" in my code? (although is still get errors on that thing too )
    im totally clueless right now
    thanks for help

  13. #13
    Join Date
    Sep 2004
    Posts
    161
    I have make some search on your problem and if i understand that i have read,
    You have not open your DB (with code) with the mdw you want used in your code
    but you can find informations with your connection with OpenSchema but i don't know how is work.
    But may be is a wrong way......

  14. #14
    Join Date
    Oct 2004
    Posts
    105
    hi i think the problem is that i open my database using ADO and then i try to get the user group name using DAO without open it with DAO first, maybe that gets me the proglem Is there a way i can do that in ADO?
    otherwise i can only think of that i will have to close the ADO connection
    open it in DAO -> get the group -> close DAO and then open it again in ADO that sounds excausting though
    I think i will try it a different way now and make a database table where the groups and users are listed in and only the Administrator of the database can make changes to, then after the user loggs in i will create a recordset and get from there which group the logged in user belongs to
    i dont know its probably not a really good solution but the open and close thing with ADO sounds not good either.
    If anybody has an idea how i can get the group name the user belongs too with ADO that would be great though
    Thanks alot have a good day

  15. #15
    Join Date
    Jan 2004
    Location
    Lancashire, UK
    Posts
    33
    I was thinking about this problem this morning while sat in the bath - don't laugh, I have all my best ideas there but unfortunately I'm no Archimedes.

    You are using VB as a front end to your Access data, and your ADO connection string will contain the user name and password of a user with permissions to use the database, for instance Admin. Therefore, the user name that you will return as the CurrentUser will always be, in this case, Admin - not the name of the actual logged in user. Does that make sense?
    I've read through the thread again and would like to ask a couple of questions, if I may. Firstly, do users login to the VB program and do they use the same name as the ones created in the workgroup file? With this information, do you create a connection string, or do you use the same one for all users? If the latter, is this why you need to know what permissions they have?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •