home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 5_2007-2008.ISO / data / Zips / Flexible_P20903811112007.psc / CUsersServices.cls < prev    next >
Text File  |  2006-01-08  |  5KB  |  170 lines

  1. VERSION 1.0 CLASS
  2. BEGIN
  3.   MultiUse = -1  'True
  4.   Persistable = 0  'NotPersistable
  5.   DataBindingBehavior = 0  'vbNone
  6.   DataSourceBehavior  = 0  'vbNone
  7.   MTSTransactionMode  = 0  'NotAnMTSObject
  8. END
  9. Attribute VB_Name = "CUsersServices"
  10. Attribute VB_GlobalNameSpace = False
  11. Attribute VB_Creatable = True
  12. Attribute VB_PredeclaredId = False
  13. Attribute VB_Exposed = False
  14. Attribute VB_Ext_KEY = "RVB_UniqueId" ,"431CF9190109"
  15. Attribute VB_Ext_KEY = "RVB_ModelStereotype" ,"Class Module"
  16. Option Explicit
  17.  
  18. '##ModelId=431CF946038A
  19. Private m_sUserName As String
  20.  
  21. '##ModelId=431CF9650290
  22. Private m_sPassword As String
  23.  
  24. '##ModelId=431CFA080000
  25. Private bEdit As Boolean
  26.  
  27. '##ModelId=431CFA18036B
  28. Private bAdd As Boolean
  29.  
  30. '##ModelId=431CFA2800CB
  31. Private bDelete As Boolean
  32.  
  33. '##ModelId=431CFE9802FD
  34. Private bLaunch As Boolean
  35.  
  36. '##ModelId=431CFF6402DE
  37. Private bAdmin As Boolean
  38.  
  39. '##ModelId=431CFFAB005D
  40. Private bValidUser As Boolean
  41.  
  42. '##ModelId=431CFFD60119
  43. Private ModulName As String
  44.  
  45. '##ModelId=431D021B0196
  46. Private m_iGroupID As Integer
  47.  
  48. Private m_iPersonnelID As Integer
  49. Private m_sGroupName As String
  50. '
  51.  
  52.  
  53. 'memeriksa keabsahan pemakai user atau password
  54. '##ModelId=431D000D03D8
  55. Public Function GetUserValidation(m_sUserName, m_sPassword) As Boolean
  56. Attribute GetUserValidation.VB_Description = "memeriksa keabsahan pemakai user atau password"
  57.     '## Your code goes here ...
  58.     
  59.     Dim oConn As New ADODB.Connection
  60.     Dim oRsValidUser As New ADODB.Recordset
  61.     Dim sSQL As String
  62.     
  63.     sSQL = "SELECT PERSONNEL_ID, USER_NAME, PASSWORD FROM USR_PERSONNELS " & _
  64.      "WHERE USER_NAME ='" & m_sUserName & "'" & _
  65.      " AND PASSWORD ='" & m_sPassword & "'"
  66.      
  67.     'Set oRsValidUser = getReadOnlyRS(sSQL)
  68.     oConn.open sConn
  69.     oRsValidUser.open sSQL, oConn
  70.     
  71.     If Not (oRsValidUser.EOF) Then
  72.        GetUserValidation = True
  73.        m_iPersonnelID = oRsValidUser.Fields("PERSONNEL_ID")
  74.        m_iGroupID = GetUserGroupsID(m_iPersonnelID)
  75.        m_sGroupName = GetUserGroupsName(m_iGroupID)
  76.        
  77.      Else
  78.        GetUserValidation = False
  79.     End If
  80.     
  81.     Set oRsValidUser = Nothing
  82.     Set oConn = Nothing
  83.     
  84. End Function
  85. Public Function GantiPassword(ByVal m_sUserName As String, _
  86.  ByVal sNewPwd As String) As Boolean
  87.  
  88.   Dim sSQL As String
  89.   sSQL = "UPDATE USR_PERSONNELS " & _
  90.      " SET PASSWORD ='" & sNewPwd & "'" & _
  91.      " WHERE USER_NAME ='" & m_sUserName & "'"
  92.   
  93.   UpdateRS (sSQL)
  94.   
  95.  
  96. End Function
  97. 'memeriksa hak user dengan masukan nama modul dan kembalian ke property bEdit,bAdd,bLaunch,bDelete
  98. '##ModelId=431D00DB00DA
  99. Public Sub GetPermission()
  100. Attribute GetPermission.VB_Description = "memeriksa hak user dengan masukan nama modul dan kembalian ke property bEdit,bAdd,bLaunch,bDelete"
  101.     '## Your code goes here ...
  102. End Sub
  103.  
  104. 'memeriksa groupID user, dari Group ini dapat ditemtukan hak-hak User hasilnya dikembalikan ke property GroupID
  105. '##ModelId=431D01840232
  106. Private Function GetUserGroupsID(m_iPersonnelID) As Integer
  107. Attribute GetUserGroupsID.VB_Description = "memeriksa groupID user, dari Group ini dapat ditemtukan hak-hak User hasilnya dikembalikan ke property GroupID"
  108.  '## Your code goes here ...
  109.  Dim oRsGrp As New ADODB.Recordset
  110.  Dim sSQL As String
  111.     
  112.  sSQL = "SELECT GROUP_ID FROM USR_GROUPS_PERSONNELS " & _
  113.   "WHERE PERSONNEL_ID = " & m_iPersonnelID
  114.   
  115.  Set oRsGrp = getReadOnlyRS(sSQL)
  116.  
  117.  If Not (oRsGrp.EOF) Then
  118.    GetUserGroupsID = oRsGrp.Fields("GROUP_ID")
  119.  Else
  120.    
  121.  End If
  122.     
  123.  Set oRsGrp = Nothing
  124.     
  125. End Function
  126. Private Function GetUserGroupsName(m_iGroupID) As String
  127.  '## Your code goes here ...
  128.  Dim oRsGrp As New ADODB.Recordset
  129.  Dim sSQL As String
  130.     
  131.  sSQL = "SELECT GROUP_NAME FROM USR_GROUPS " & _
  132.   "WHERE GROUP_ID = " & m_iGroupID
  133.   
  134.  Set oRsGrp = getReadOnlyRS(sSQL)
  135.  
  136.  If Not (oRsGrp.EOF) Then
  137.    GetUserGroupsName = oRsGrp.Fields("GROUP_NAME")
  138.  Else
  139.    
  140.  End If
  141.     
  142.  Set oRsGrp = Nothing
  143.     
  144. End Function
  145.  
  146. Public Property Get UserName() As String
  147.   UserName = m_sUserName
  148. End Property
  149.  
  150. Public Property Let UserName(ByVal vNewValue As String)
  151.  m_sUserName = vNewValue
  152.  
  153. End Property
  154.  
  155. Public Property Get Password() As String
  156.  Password = m_sPassword
  157. End Property
  158.  
  159. Public Property Let Password(ByVal vNewValue As String)
  160.  m_sPassword = vNewValue
  161. End Property
  162. Public Property Get PersonnelID() As Integer
  163.  PersonnelID = m_iPersonnelID
  164. End Property
  165.  
  166. Public Property Get GroupName() As String
  167.  GroupName = m_sGroupName
  168. End Property
  169.  
  170.