sysuser.sql 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. {**************************************************************************}
  2. {* *}
  3. {* Licensed Materials - Property of IBM and/or HCL *}
  4. {* *}
  5. {* IBM Informix Dynamic Server *}
  6. {* (c) Copyright IBM Corporation 1996, 2011 All rights reserved. *}
  7. {* (c) Copyright HCL Technologies Ltd. 2017. All Rights Reserved. *}
  8. {* *}
  9. {**************************************************************************}
  10. { }
  11. { Title: sysuser.sql }
  12. { Description: create sysuser database }
  13. create database sysuser with log;
  14. create table informix.sysauth (
  15. username char(32) not null, { User login id }
  16. groupname char(32), { Group name - unused }
  17. servers varchar(128) not null, { Informix server }
  18. hosts varchar(128) not null, { Host for Informix server }
  19. check (groupname is null)
  20. ) LOCK MODE ROW;
  21. create unique index informix.sysauth_idx on sysauth(username, servers, hosts) in table;
  22. revoke all on sysauth from public as informix;
  23. grant select on sysauth to public as informix;
  24. create table informix.sysdbsecadmauth (
  25. grantee nchar(32), { DBSECADM role grantee }
  26. database nvarchar(128) { Database name - unused }
  27. ) LOCK MODE ROW;
  28. create unique index informix.sysdbsecadmauth_idx on sysdbsecadmauth(grantee) in table;
  29. revoke all on sysdbsecadmauth from public as informix;
  30. grant select on sysdbsecadmauth to public as informix;
  31. create table informix.syssurrogates
  32. (
  33. surrogate_id serial,
  34. os_username nchar(32),
  35. uid int,
  36. gid int,
  37. groupname nchar(32),
  38. homedir nvarchar(255),
  39. userauth char(10)
  40. ) LOCK MODE ROW;
  41. create unique index informix.syssurrogates_idx_sid on syssurrogates (surrogate_id) in table;
  42. create index informix.syssurrogates_idx_uname_uauth on syssurrogates (os_username, userauth) in table;
  43. create index informix.syssurrogates_idx_uid_gid_uauth on syssurrogates (uid, gid, userauth) in table;
  44. create index informix.syssurrogates_idx_uid_gname_uauth on syssurrogates (uid, groupname, userauth) in table;
  45. create index informix.syssurrogates_idx_uname_gid_uauth on syssurrogates (os_username, gid, userauth) in table;
  46. create index informix.syssurrogates_idx_uname_gname_uauth on syssurrogates (os_username, groupname, userauth) in table;
  47. revoke all on syssurrogates from public as informix;
  48. grant select on syssurrogates to public as informix;
  49. create table informix.sysusermap
  50. (
  51. username nchar(32),
  52. surrogate_id int
  53. ) LOCK MODE ROW;
  54. create unique index informix.sysusermap_idx_username on sysusermap(username) in table;
  55. create index informix.sysusermap_idx_surrogateid on sysusermap(surrogate_id) in table;
  56. revoke all on sysusermap from public as informix;
  57. grant select on sysusermap to public as informix;
  58. create table informix.syssurrogategroups
  59. (
  60. surrogate_id int,
  61. gid int,
  62. groupname nchar(32),
  63. groupseq smallint
  64. ) LOCK MODE ROW;
  65. create unique index informix.syssurrogategroups_idx_sid_grpseq on syssurrogategroups(surrogate_id, groupseq) in table;
  66. revoke all on syssurrogategroups from public as informix;
  67. grant select on syssurrogategroups to public as informix;
  68. create table informix.sysintauthusers
  69. (
  70. username NCHAR(32),
  71. salt BIGINT,
  72. hashed_password VARCHAR(128), {Hex encoded: allow expansion to 512-bit hashes, SHA-256 needs just 64, SHA-1 needs just 40}
  73. hash_type CHAR(16),
  74. updated DATETIME YEAR TO SECOND {TIMESTAMP},
  75. flags INTEGER,
  76. min_change INTERVAL DAY(7) TO SECOND,
  77. max_change INTERVAL DAY(7) TO SECOND,
  78. inactive INTERVAL DAY(7) TO SECOND,
  79. ac_expire DATETIME YEAR TO SECOND {TIMESTAMP - when a/c cannot be used any longer}
  80. ) lock mode row;
  81. create unique index informix.sysintauthusers_idx_username on sysintauthusers(username) in table;
  82. revoke all on sysintauthusers from public as informix;
  83. grant select on sysintauthusers to public as informix;
  84. /****** Trusted Context ******/
  85. create table informix.systrustedcontext
  86. (
  87. contextid serial,
  88. contextname varchar(128),
  89. database char(128),
  90. authid char(32),
  91. defaultrole char(32),
  92. enabled char(1) not null,
  93. encryption char(1)
  94. ) LOCK MODE ROW;
  95. create unique index informix.systcx_ctxid on systrustedcontext(contextid) in table;
  96. create unique index informix.systcx_ctxname on systrustedcontext(contextname) in table;
  97. create unique index informix.systcx_authid on systrustedcontext(authid) in table;
  98. revoke all on systrustedcontext from public as informix;
  99. grant select on systrustedcontext to public as informix;
  100. create table informix.systcxattributes
  101. (
  102. contextid integer not null,
  103. address char(64),
  104. encryption char(1)
  105. ) LOCK MODE ROW;
  106. create index informix.systcxatt_ctxid on systcxattributes(contextid) in table;
  107. create unique index informix.systcxatt_ctxaddr on systcxattributes(contextid, address) in table;
  108. revoke all on systcxattributes from public as informix;
  109. grant select on systcxattributes to public as informix;
  110. create table informix.systcxusers
  111. (
  112. contextid integer not null,
  113. username char(32),
  114. usertype char(1),
  115. userrole char(32),
  116. authreq char(1)
  117. ) LOCK MODE ROW;
  118. create index informix.systcxusr_ctxid on systcxusers(contextid) in table;
  119. create unique index informix.systcxusr_username on systcxusers(contextid, username) in table;
  120. revoke all on systcxusers from public as informix;
  121. grant select on systcxusers to public as informix;
  122. grant connect to public;
  123. close database;