Produced by Araxis Merge on 3/13/2019 2:49:53 PM Central Daylight Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.
| # | Location | File | Last Modified |
|---|---|---|---|
| 1 | C:\AraxisMergeCompare\Pri_un\DSM\Direct_Webmail\application\controllers | Install.php | Tue Mar 12 22:00:20 2019 UTC |
| 2 | C:\AraxisMergeCompare\Pri_re\DSM-scrubbed\Direct_Webmail\application\controllers | Install.php | Wed Mar 13 19:22:02 2019 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 9 | 3534 |
| Changed | 8 | 20 |
| Inserted | 0 | 0 |
| Removed | 0 | 0 |
| Whitespace | |
|---|---|
| Character case | Differences in character case are significant |
| Line endings | Differences in line endings (CR and LF characters) are ignored |
| CR/LF characters | Not shown in the comparison detail |
No regular expressions were active.
| 1 | <?php defi ned('BASEP ATH') OR e xit('No di rect scrip t access a llowed'); | |
| 2 | /** | |
| 3 | * @package direct-pr oject-inno vation-ini tiative | |
| 4 | * @subpack age contro llers | |
| 5 | */ | |
| 6 | ||
| 7 | /** | |
| 8 | * @package direct-pr oject-inno vation-ini tiative | |
| 9 | * @subpack age contro llers | |
| 10 | */ | |
| 11 | class Inst all extend s CI_Contr oller { | |
| 12 | va r $title = 'Configur ation Scri pt'; | |
| 13 | va r $ldap_ou s_to_add = array( 'd istributio n lists' = > LDAP_DIS TRUBUTION_ LIST_DN, | |
| 14 | 'deleted distribut ion lists' => LDAP_D ELETED_DIS TRUBUTION_ LIST_DN ); | |
| 15 | ||
| 16 | // these are set in the construct or | |
| 17 | va r $databas e_schema = array(); | |
| 18 | va r $databas e_queries = array(); | |
| 19 | va r $databas e_table_qu eries = ar ray(); | |
| 20 | va r $ldap_sc hema = arr ay(); | |
| 21 | ||
| 22 | // we pull ou r database configura tion from constants and use it like CI w ould, | |
| 23 | // but we don 't use the CI Databa se class i n this ins tall scrip t due to t he difficu lty | |
| 24 | // in getting useful er ror messag es when ru nning mult iple queri es, which is necessa ry for cre ating the tables | |
| 25 | va r $db_requ ired_permi ssions = a rray('db_d atareader' => FALSE, 'db_dataw riter' => FALSE); | |
| 26 | va r $databas e_serverna me = DATAB ASE_HOSTNA ME; | |
| 27 | va r $databas e_config = array ( | |
| 28 | 'UID' => DAT ABASE_USER NAME, | |
| 29 | 'PWD' => DAT ABASE_PASS WORD, | |
| 30 | 'Databas e' => 'ma ster', | |
| 31 | 'Connect ionPooling ' => 0, | |
| 32 | 'ReturnD atesAsStri ngs' => 1, | |
| 33 | 'LoginTi meout' => 5, | |
| 34 | ); | |
| 35 | ||
| 36 | pu blic funct ion __cons truct(){ | |
| 37 | glob al $instal ler; | |
| 38 | $ins taller = T RUE; | |
| 39 | pare nt::__cons truct(); | |
| 40 | $thi s->config- >set_item( 'sess_use_ database', FALSE); | |
| 41 | $thi s->config- >set_item( 'sess_encr ypt_cookie ', FALSE); | |
| 42 | ||
| 43 | requ ire_librar y('validat or'); | |
| 44 | $thi s->load->h elper(arra y('loader' ,'url')); | |
| 45 | $thi s->load->l ibrary(arr ay('sessio n','encryp t')); | |
| 46 | ||
| 47 | //fo r now the tables wil l be creat ed in the order they are put i n this arr ay, | |
| 48 | //ke ep that in mind when setting u p foreign key relati ons, etc. | |
| 49 | //TO -DO: Inclu de array s orting fun ction for preferred creation o rder | |
| 50 | $thi s->databas e_schema = array( | |
| 51 | 'users' => ar ray( | |
| 52 | 'user_ id' => 'bi gint', | |
| 53 | 'user_ edipi' => 'bigint', | |
| 54 | 'user_ piv_id' => 'bigint', | |
| 55 | 'user_ name' => ' nvarchar(5 0)', | |
| 56 | 'user_ mail' => ' nvarchar(5 0)', | |
| 57 | 'user_ theme' => 'bigint', | |
| 58 | 'user_ ep' => 'nv archar(max )', | |
| 59 | 'user_ created_by ' => 'bigi nt', | |
| 60 | 'user_ created_da te' => 'bi gint', | |
| 61 | 'user_ ext_notify _flag' => 'tinyint', | |
| 62 | 'user_ ext_group_ notify_fla g' => 'tin yint', | |
| 63 | 'user_ deleted_fl ag' => 'ti nyint', | |
| 64 | 'user_ locale' => 'nvarchar (max)', | |
| 65 | 'user_ is_group' => 'tinyin t', | |
| 66 | 'defau lt_mailbox ' => 'nvar char(100)' , | |
| 67 | ), | |
| 68 | 'contact s' => arra y( | |
| 69 | 'contact_i d' => 'big int', | |
| 70 | 'user_id' => 'bigint ', | |
| 71 | 'first_nam e' => 'var char(max)' , | |
| 72 | 'middle_na me' => 'va rchar(max) ', | |
| 73 | 'last_name ' => 'varc har(max)', | |
| 74 | 'organizat ion' => 'n varchar(ma x)', | |
| 75 | 'departmen t' => 'nva rchar(max) ', | |
| 76 | 'telephone ' => 'nvar char(50)', | |
| 77 | 'mail' => 'nvarchar( 50)', | |
| 78 | 'title' => 'nvarchar (max)', | |
| 79 | ), | |
| 80 | 'distrib ution_list s' => arra y( | |
| 81 | 'id' => 'b igint', | |
| 82 | 'name' => 'varchar(m ax)', | |
| 83 | 'descripti on' => 'va rchar(max) ', | |
| 84 | 'created_b y' => 'big int', | |
| 85 | 'created_a t' => 'big int', | |
| 86 | 'modified_ at' => 'bi gint', | |
| 87 | 'addresses ' => 'varc har(max)', | |
| 88 | ), | |
| 89 | 'edit_lo g' => arra y( | |
| 90 | 'edit_ id' => 'bi gint', | |
| 91 | 'targe t_user_id' => 'bigin t', | |
| 92 | 'actor _user_id' => 'bigint ', | |
| 93 | 'edit_ action' => 'text', | |
| 94 | 'edit_ datetime' => 'bigint ', | |
| 95 | ), | |
| 96 | 'feedbac k' => arra y( | |
| 97 | 'feedb ack_id' => 'bigint', | |
| 98 | 'user_ id' => 'bi gint', | |
| 99 | 'feedb ack_type' => 'nvarch ar(50)', | |
| 100 | 'feedb ack_commen ts' => 'te xt', | |
| 101 | 'feedb ack_dateti me' => 'bi gint', | |
| 102 | ), | |
| 103 | 'flags' => array( | |
| 104 | 'id' = > 'bigint' , | |
| 105 | 'messa ge_id' => 'bigint', | |
| 106 | 'color ' => 'varc har(50)', | |
| 107 | 'conte nt' => 'va rchar(max) ', | |
| 108 | 'mailb ox_group' => 'nvarch ar(50)', | |
| 109 | 'creat ed_by' => 'bigint', | |
| 110 | 'modif ied_by' => 'bigint', | |
| 111 | 'creat ed_at' => 'bigint', | |
| 112 | 'modif ied_at' => 'bigint', | |
| 113 | ), | |
| 114 | 'logins' => array( | |
| 115 | 'id' = > 'bigint' , | |
| 116 | 'sessi on_id' => 'nvarchar( 50)', | |
| 117 | 'usern ame' => 'v archar(50) ', | |
| 118 | 'ip_ad dress' => 'nvarchar( 50)', | |
| 119 | 'login _time' => 'bigint', | |
| 120 | 'succe ss' => 'ti nyint', | |
| 121 | 'error _msg' => ' nvarchar(m ax)', | |
| 122 | ), | |
| 123 | 'mail_lo g' => arra y( | |
| 124 | 'id' = > 'bigint' , | |
| 125 | 'time' => 'bigin t', | |
| 126 | 'size' => 'bigin t', | |
| 127 | 'sende r' => 'var char(max)' , | |
| 128 | 'recip ient' => ' varchar(ma x)', | |
| 129 | 'attac hment_type s' => 'nva rchar(max) ', | |
| 130 | 'succe ss' => 'ti nyint', | |
| 131 | 'inbou nd_outboun d' => 'tin yint', | |
| 132 | ), | |
| 133 | 'request s' => arra y( | |
| 134 | 'reque st_id' => 'bigint', | |
| 135 | 'user_ name' => ' nvarchar(m ax)', | |
| 136 | 'user_ edipi' => 'bigint', | |
| 137 | 'user_ piv_id' => 'bigint', | |
| 138 | 'reque st_date' = > 'bigint' , | |
| 139 | 'first _name' => 'varchar(m ax)', | |
| 140 | 'middl e_name' => 'varchar( max)', | |
| 141 | 'last_ name' => ' varchar(ma x)', | |
| 142 | 'organ ization' = > 'nvarcha r(max)', | |
| 143 | 'depar tment' => 'nvarchar( max)', | |
| 144 | 'telep hone' => ' nvarchar(5 0)', | |
| 145 | 'mail' => 'nvarc har(max)', | |
| 146 | 'title ' => 'nvar char(max)' , | |
| 147 | 'appro ved_flag' => 'tinyin t', | |
| 148 | 'creat ed_flag' = > 'tinyint ', | |
| 149 | 'denie d_flag' => 'tinyint' , | |
| 150 | ), | |
| 151 | 'session s' => arra y( | |
| 152 | 'sessi on_id' => 'varchar(5 0)', | |
| 153 | 'ip_ad dress' => 'varchar(5 0)', | |
| 154 | 'user_ agent' => 'varchar(m ax)', | |
| 155 | 'last_ activity' => 'int', | |
| 156 | 'user_ data' => ' text', | |
| 157 | 'last_ session_id ' => 'varc har(50)' | |
| 158 | ), | |
| 159 | 'themes' => ar ray( | |
| 160 | 'theme _id' => 'b igint', | |
| 161 | 'theme _css_name' => 'nvarc har(50)', | |
| 162 | 'theme _display_n ame' => 't ext', | |
| 163 | 'theme _preview_b g' => 'nva rchar(max) ', | |
| 164 | 'theme _banner_im g' => 'nva rchar(max) ', | |
| 165 | 'theme _banner_al t_text' => 'nvarchar (max)', | |
| 166 | 'theme _is_defaul t' => 'tin yint', | |
| 167 | ), | |
| 168 | 'workflo w_items' = > arra y( | |
| 169 | 'id' => 'b igint', | |
| 170 | 'message_i d' => 'big int', | |
| 171 | 'mailbox_g roup' => ' nvarchar(5 0)', | |
| 172 | 'assigned_ to' => 'bi gint', | |
| 173 | 'complete' => 'tinyi nt', | |
| 174 | 'created_b y' => 'big int', | |
| 175 | 'modified_ by' => 'bi gint', | |
| 176 | 'created_a t' => 'big int', | |
| 177 | 'modified_ at' => 'bi gint', | |
| 178 | ), | |
| 179 | 'admin_c ontact_lis t' => array( | |
| 180 | 'con tact_id' = > 'bigint' , | |
| 181 | 'fir st_name' = > 'nvarcha r(max)', | |
| 182 | 'mid dle_name' => 'nvarch ar(max)', | |
| 183 | 'las t_name' => 'nvarchar (max)', | |
| 184 | 'tit le' => 'nv archar(max )', | |
| 185 | 'dep artment' = > 'nvarcha r(max)', | |
| 186 | 'org anization' => 'nvarc har(max)', | |
| 187 | 'tel ephone' => 'nvarchar (50)', | |
| 188 | 'sha ring' => ' nvarchar(m ax)', | |
| 189 | 'dir ect_addres s' => 'nva rchar(max) ', | |
| 190 | 'mob ile' => 'n varchar(50 )', | |
| 191 | 'mod ified_by' => 'bigint ', | |
| 192 | 'mod ified_at' => 'bigint ', | |
| 193 | ), | |
| 194 | 'das_res ults' => arra y( | |
| 195 | 'id' => 'b igint', | |
| 196 | 'created_b y' => 'nva rchar(max) ', | |
| 197 | 'saved_dat e' => 'big int', | |
| 198 | 'result_st atus' => ' nchar(10)' , | |
| 199 | 'attachmen t_name' => 'nvarchar (max)', | |
| 200 | 'hash_atta chment_nam e' => 'nva rchar(512) ', | |
| 201 | 'das_docum ent_id' => 'nvarchar (max)', | |
| 202 | 'message_i d' => 'big int', | |
| 203 | ), | |
| 204 | 'archive _settings' => arra y( | |
| 205 | 'i d' => 'big int', | |
| 206 | 'f requency' => 'varcha r(200)', | |
| 207 | 'a rchive_age ' => 'int' , | |
| 208 | 'l ast_execut ion_time' => 'bigint ', | |
| 209 | 'a rchive_age _unit' => 'nvarchar( 200)', | |
| 210 | ), | |
| 211 | 'respons e' => ar ray( | |
| 212 | 'id' => 'bigin t', | |
| 213 | 'mes sage_id' = > 'bigint' , | |
| 214 | 'par ent_id' => 'bigint', | |
| 215 | 'typ e' => 'nva rchar(10)' , | |
| 216 | ), | |
| 217 | 'announc ements' => array( | |
| 218 | 'id' => 'bigin t', | |
| 219 | 'con tent' => ' nvarchar(1 000)', | |
| 220 | 'ena bled' => ' bit', | |
| 221 | 'upd ated_at' = > 'bigint' , | |
| 222 | 'upd ated_by' = > 'bigint' , | |
| 223 | ), | |
| 224 | 'global_ contacts_s hared' => array( | |
| 225 | 'con tact_id' = > 'bigint' , | |
| 226 | 'use r_id' => ' bigint', | |
| 227 | ), | |
| 228 | ||
| 229 | ); | |
| 230 | $thi s->databas e_queries = array( | |
| 231 | 'create_ ' . DATABA SE_NAME => " | |
| 232 | USE [master]; | |
| 233 | IF N OT EXISTS( SELECT nam e FROM mas ter.sys.da tabases WH ERE name = N'direct' ) | |
| 234 | BEGI N | |
| 235 | CREA TE DATABAS E [direct] | |
| 236 | ALTE R DATABASE [direct] SET COMPAT IBILITY_LE VEL = 100 | |
| 237 | ||
| 238 | IF ( 1 = FULLTE XTSERVICEP ROPERTY('I sFullTextI nstalled') ) | |
| 239 | BEGI N | |
| 240 | EXEC [direct]. [dbo].[sp_ fulltext_d atabase] @ action = ' enable' | |
| 241 | END | |
| 242 | ALTE R DATABASE [direct] SET ANSI_N ULL_DEFAUL T OFF | |
| 243 | ALTE R DATABASE [direct] SET ANSI_N ULLS OFF | |
| 244 | ALTE R DATABASE [direct] SET ANSI_P ADDING OFF | |
| 245 | ALTE R DATABASE [direct] SET ANSI_W ARNINGS OF F | |
| 246 | ALTE R DATABASE [direct] SET ARITHA BORT OFF | |
| 247 | ALTE R DATABASE [direct] SET AUTO_C LOSE OFF | |
| 248 | ALTE R DATABASE [direct] SET AUTO_C REATE_STAT ISTICS ON | |
| 249 | ALTE R DATABASE [direct] SET AUTO_S HRINK OFF | |
| 250 | ALTE R DATABASE [direct] SET AUTO_U PDATE_STAT ISTICS ON | |
| 251 | ALTE R DATABASE [direct] SET CURSOR _CLOSE_ON_ COMMIT OFF | |
| 252 | ALTE R DATABASE [direct] SET CURSOR _DEFAULT GLOBAL | |
| 253 | ALTE R DATABASE [direct] SET CONCAT _NULL_YIEL DS_NULL OF F | |
| 254 | ALTE R DATABASE [direct] SET NUMERI C_ROUNDABO RT OFF | |
| 255 | ALTE R DATABASE [direct] SET QUOTED _IDENTIFIE R OFF | |
| 256 | ALTE R DATABASE [direct] SET RECURS IVE_TRIGGE RS OFF | |
| 257 | ALTE R DATABASE [direct] SET DISAB LE_BROKER | |
| 258 | ALTE R DATABASE [direct] SET AUTO_U PDATE_STAT ISTICS_ASY NC OFF | |
| 259 | ALTE R DATABASE [direct] SET DATE_C ORRELATION _OPTIMIZAT ION OFF | |
| 260 | ALTE R DATABASE [direct] SET TRUSTW ORTHY OFF | |
| 261 | ALTE R DATABASE [direct] SET ALLOW_ SNAPSHOT_I SOLATION O FF | |
| 262 | ALTE R DATABASE [direct] SET PARAME TERIZATION SIMPLE | |
| 263 | ALTE R DATABASE [direct] SET READ_C OMMITTED_S NAPSHOT OF F | |
| 264 | ALTE R DATABASE [direct] SET HONOR_ BROKER_PRI ORITY OFF | |
| 265 | ALTE R DATABASE [direct] SET READ_ WRITE | |
| 266 | ALTE R DATABASE [direct] SET RECOVE RY FULL | |
| 267 | ALTE R DATABASE [direct] SET MULTI _USER | |
| 268 | ALTE R DATABASE [direct] SET PAGE_V ERIFY CHEC KSUM | |
| 269 | ALTE R DATABASE [direct] SET DB_CHA INING OFF | |
| 270 | END | |
| 271 | ", | |
| 272 | ); | |
| 273 | $thi s->databas e_table_qu eries = ar ray( | |
| 274 | 'create_ contacts' => " | |
| 275 | USE [".D ATABASE_NA ME."] | |
| 276 | SET ANSI _NULLS ON | |
| 277 | SET QUOT ED_IDENTIF IER ON | |
| 278 | SET ANSI _PADDING O N | |
| 279 | ||
| 280 | IF NOT E XISTS (SEL ECT * FROM sys.objec ts WHERE o bject_id = OBJECT_ID (N'[dbo].[ contacts]' ) AND type in (N'U') ) | |
| 281 | BEGIN | |
| 282 | USE [".D ATABASE_NA ME."] | |
| 283 | CREATE T ABLE [dbo] .[contacts ]( | |
| 284 | [contact_i d] [bigint ] IDENTITY (1,1) NOT NULL, | |
| 285 | [user_id] [bigint] N OT NULL, | |
| 286 | [first_nam e] [varcha r](max) NO T NULL, | |
| 287 | [middle_na me] [varch ar](max) N ULL, | |
| 288 | [last_name ] [varchar ](max) NUL L, | |
| 289 | [organizat ion] [nvar char](max) NULL, | |
| 290 | [departmen t] [nvarch ar](max) N ULL, | |
| 291 | [telephone ] [nvarcha r](50) NUL L, | |
| 292 | [mail] [nv archar](50 ) NOT NULL , | |
| 293 | [title] [n varchar](m ax) NULL, | |
| 294 | CONSTRA INT [PK_co ntacts] PR IMARY KEY NONCLUSTER ED ([conta ct_id] ASC ) | |
| 295 | WITH (P AD_INDEX = OFF, STA TISTICS_NO RECOMPUTE = OFF, IG NORE_DUP_K EY = OFF, ALLOW_ROW_ LOCKS = O N, ALLOW_P AGE_LOCKS = ON) ON [PRIMARY]) | |
| 296 | ON [PRI MARY] | |
| 297 | END | |
| 298 | ||
| 299 | SET ANSI _PADDING O FF | |
| 300 | ||
| 301 | IF NOT EXISTS (SE LECT * FRO M sys.fore ign_keys W HERE objec t_id = OBJ ECT_ID(N'[ dbo].[FK_c ontacts_us ers]') AND parent_ob ject_id = OBJECT_ID( N'[dbo].[c ontacts]') ) | |
| 302 | BEGIN | |
| 303 | ALTER TA BLE [dbo]. [contacts] WITH CHE CK ADD CO NSTRAINT [ FK_contact s_users] F OREIGN KEY ([user_id] ) | |
| 304 | REFERENC ES [dbo].[ users] ([u ser_id]) | |
| 305 | END | |
| 306 | ||
| 307 | IF NOT EXISTS (SE LECT * FRO M sys.fore ign_keys W HERE objec t_id = OBJ ECT_ID(N'[ dbo].[FK_c ontacts_us ers]') AND parent_ob ject_id = OBJECT_ID( N'[dbo].[c ontacts]') ) | |
| 308 | BEGIN | |
| 309 | ALTER TA BLE [dbo]. [contacts] CHECK CON STRAINT [F K_contacts _users] | |
| 310 | END | |
| 311 | ||
| 312 | IF EXIS TS (SELECT * FROM sy s.indexes WHERE obje ct_id = OB JECT_ID(N' [dbo].[con tacts]') A ND name = N'PK_conta cts') | |
| 313 | ALTER TA BLE [dbo]. [contacts] DROP CONS TRAINT [PK _contacts] | |
| 314 | /****** Object: I ndex [PK_c ontacts] Script D ate: 11/15 /2013 07:1 7:11 ***** */ | |
| 315 | ALTER TA BLE [dbo]. [contacts] ADD CONS TRAINT [PK _contacts] PRIMARY K EY NONCLUS TERED | |
| 316 | ([contac t_id] ASC) | |
| 317 | WITH (PA D_INDEX = OFF, STAT ISTICS_NOR ECOMPUTE = OFF, SOR T_IN_TEMPD B = OFF, I GNORE_DUP_ KEY = OFF, ONLINE = OFF, ALLOW _ROW_LOCKS = ON, AL LOW_PAGE_L OCKS = ON ) ON [PRIM ARY] | |
| 318 | ||
| 319 | IF NOT E XISTS (SEL ECT * FROM sys.index es WHERE o bject_id = OBJECT_ID (N'[dbo].[ contacts]' ) AND name = N'IX_co ntact_user ') | |
| 320 | CREATE C LUSTERED I NDEX [IX_c ontact_use r] ON [dbo ].[contact s] | |
| 321 | ([user_i d] ASC) | |
| 322 | WITH (PA D_INDEX = OFF, STAT ISTICS_NOR ECOMPUTE = OFF, SOR T_IN_TEMPD B = OFF, I GNORE_DUP_ KEY = OFF, DROP_EXIS TING = OFF , ONLINE = OFF, ALLO W_ROW_LOCK S = ON, A LLOW_PAGE_ LOCKS = O N) ON [PRI MARY] | |
| 323 | ", | |
| 324 | 'create_ distributi on_lists' => " | |
| 325 | USE [".DATABAS E_NAME."]; | |
| 326 | SET ANSI_NULLS ON | |
| 327 | SET QUOTED_IDE NTIFIER ON | |
| 328 | SET ANSI_PADDI NG ON | |
| 329 | IF N OT EXISTS (SELECT * FROM sys.o bjects WHE RE object_ id = OBJEC T_ID(N'[db o].[distri bution_lis ts]') AND type in (N 'U')) | |
| 330 | BEGI N | |
| 331 | CREA TE TABLE [ dbo].[dist ribution_l ists]( | |
| 332 | [id] [ bigint] ID ENTITY(1,1 ) NOT NULL , | |
| 333 | [name] [varchar] (max) NOT NULL, | |
| 334 | [descr iption] [v archar](ma x) NULL, | |
| 335 | [creat ed_by] [bi gint] NOT NULL, | |
| 336 | [creat ed_at] [bi gint] NOT NULL, | |
| 337 | [modif ied_at] [b igint] NOT NULL, | |
| 338 | [addre sses] [var char](max) NOT NULL default '' , | |
| 339 | CON STRAINT [P K_distribu tion_lists ] PRIMARY KEY NONCLU STERED ([i d] ASC) | |
| 340 | WIT H (PAD_IND EX = OFF, STATISTIC S_NORECOMP UTE = OFF , IGNORE_D UP_KEY = O FF, ALLOW_ ROW_LOCKS = ON, ALL OW_PAGE_LO CKS = ON) ON [PRIMA RY]) | |
| 341 | ON [PRIMARY] | |
| 342 | END | |
| 343 | SET ANSI_PADDI NG OFF | |
| 344 | ||
| 345 | IF NOT EXISTS (SELECT * FROM sys. foreign_ke ys WHERE o bject_id = OBJECT_ID (N'[dbo].[ FK_user]') AND paren t_object_i d = OBJECT _ID(N'[dbo ].[distrib ution_list s]')) | |
| 346 | BEGI N | |
| 347 | ALTE R TABLE [d bo].[distr ibution_li sts] WITH CHECK ADD CONSTRAI NT [FK_use r] FOREIGN KEY([crea ted_by]) | |
| 348 | REFE RENCES [db o].[users] ([user_id ]) | |
| 349 | END | |
| 350 | ||
| 351 | IF NOT EXISTS (SELECT * FROM sys. foreign_ke ys WHERE o bject_id = OBJECT_ID (N'[dbo].[ FK_user]') AND paren t_object_i d = OBJECT _ID(N'[dbo ].[distrib ution_list s]')) | |
| 352 | BEGI N | |
| 353 | ALTE R TABLE [d bo].[distr ibution_li sts] CHECK CONSTRAIN T [FK_user ] | |
| 354 | END | |
| 355 | ||
| 356 | IF N OT EXISTS (SELECT * FROM sys.i ndexes WHE RE object_ id = OBJEC T_ID(N'[db o].[distri bution_lis ts]') AND name = N'I X_distribu tion_lists ') | |
| 357 | BEGI N | |
| 358 | CREA TE CLUSTER ED INDEX [ IX_distrib ution_list s] ON [dbo ].[distrib ution_list s] ([creat ed_by] ASC ) | |
| 359 | WITH (PAD_INDE X = OFF, STATISTICS _NORECOMPU TE = OFF, SORT_IN_T EMPDB = OF F, IGNORE_ DUP_KEY = OFF, DROP_ EXISTING = OFF, ONLI NE = OFF, ALLOW_ROW_ LOCKS = O N, ALLOW_P AGE_LOCKS = ON) ON [PRIMARY] | |
| 360 | END | |
| 361 | ", | |
| 362 | 'create_ edit_log' => " | |
| 363 | US E [".DATAB ASE_NAME." ]; | |
| 364 | SE T ANSI_NUL LS ON | |
| 365 | SE T QUOTED_I DENTIFIER ON | |
| 366 | SE T ANSI_PAD DING ON | |
| 367 | IF NOT EXIST S (SELECT * FROM sys .objects W HERE objec t_id = OBJ ECT_ID(N'[ dbo].[edit _log]') AN D type in (N'U')) | |
| 368 | BE GIN | |
| 369 | CR EATE TABLE [dbo].[ed it_log]( | |
| 370 | [edi t_id] [big int] IDENT ITY(1,1) N OT NULL, | |
| 371 | [tar get_user_i d] [bigint ] NOT NULL , | |
| 372 | [act or_user_id ] [bigint] NOT NULL, | |
| 373 | [edi t_action] [text] NOT NULL, | |
| 374 | [edi t_datetime ] [bigint] NOT NULL, | |
| 375 | CO NSTRAINT [ PK_edit_lo g] PRIMARY KEY CLUST ERED ([edi t_id] ASC) | |
| 376 | WI TH (PAD_IN DEX = OFF , STATISTI CS_NORECOM PUTE = OF F, IGNORE_ DUP_KEY = OFF, ALLOW _ROW_LOCKS = ON, AL LOW_PAGE_L OCKS = ON ) ON [PRIM ARY]) ON [ PRIMARY] | |
| 377 | EN D | |
| 378 | ", | |
| 379 | 'create_ feedback' => " | |
| 380 | US E [".DATAB ASE_NAME." ]; | |
| 381 | SE T ANSI_NUL LS ON | |
| 382 | SE T QUOTED_I DENTIFIER ON | |
| 383 | SE T ANSI_PAD DING ON | |
| 384 | IF NOT EXIST S (SELECT * FROM sys .objects W HERE objec t_id = OBJ ECT_ID(N'[ dbo].[feed back]') AN D type in (N'U')) | |
| 385 | BE GIN | |
| 386 | CR EATE TABLE [dbo].[fe edback]( | |
| 387 | [fee dback_id] [bigint] I DENTITY(1, 1) NOT NUL L, | |
| 388 | [use r_id] [big int] NOT N ULL, | |
| 389 | [fee dback_type ] [nvarcha r](50) NOT NULL, | |
| 390 | [fee dback_comm ents] [tex t] NOT NUL L, | |
| 391 | [fee dback_date time] [big int] NOT N ULL, | |
| 392 | CO NSTRAINT [ PK_feedbac k] PRIMARY KEY CLUST ERED ([fee dback_id] ASC) | |
| 393 | WI TH (PAD_IN DEX = OFF , STATISTI CS_NORECOM PUTE = OF F, IGNORE_ DUP_KEY = OFF, ALLOW _ROW_LOCKS = ON, AL LOW_PAGE_L OCKS = ON ) ON [PRIM ARY]) ON [ PRIMARY] | |
| 394 | EN D | |
| 395 | ", | |
| 396 | 'create_ flags' => " | |
| 397 | USE [".D ATABASE_NA ME."]; | |
| 398 | SET ANSI _NULLS ON | |
| 399 | SET QUOT ED_IDENTIF IER ON | |
| 400 | SET ANSI _PADDING O N | |
| 401 | IF NOT E XISTS (SEL ECT * FROM sys.objec ts WHERE o bject_id = OBJECT_ID (N'[dbo].[ flags]') A ND type in (N'U')) | |
| 402 | BEGIN | |
| 403 | CREATE T ABLE [dbo] .[flags]( | |
| 404 | [id] [bigi nt] IDENTI TY(1,1) NO T NULL, | |
| 405 | [message_i d] [bigint ] NOT NULL , | |
| 406 | [color] [v archar](50 ) NULL, | |
| 407 | [content] [varchar]( max) NULL, | |
| 408 | [mailbox_g roup] [nva rchar](50) NOT NULL, | |
| 409 | [created_b y] [bigint ] NOT NULL , | |
| 410 | [modified_ by] [bigin t] NOT NUL L, | |
| 411 | [created_a t] [bigint ] NOT NULL , | |
| 412 | [modified_ at] [bigin t] NOT NUL L, | |
| 413 | CONSTRAI NT [PK_fla g] PRIMARY KEY NONCL USTERED | |
| 414 | ([id] AS C) | |
| 415 | WITH (PA D_INDEX = OFF, STAT ISTICS_NOR ECOMPUTE = OFF, IGN ORE_DUP_KE Y = OFF, A LLOW_ROW_L OCKS = ON , ALLOW_PA GE_LOCKS = ON) ON [ PRIMARY]) ON [PRIMAR Y] | |
| 416 | END | |
| 417 | ||
| 418 | SET ANSI _PADDING O FF | |
| 419 | ||
| 420 | IF NOT EXISTS (SE LECT * FRO M sys.fore ign_keys W HERE objec t_id = OBJ ECT_ID(N'[ dbo].[FK_c reated_by] ') AND par ent_object _id = OBJE CT_ID(N'[d bo].[flags ]')) | |
| 421 | BEGIN | |
| 422 | ALTER TA BLE [dbo]. [flags] W ITH CHECK ADD CONSTR AINT [FK_c reated_by] FOREIGN K EY([create d_by]) | |
| 423 | REFERENC ES [dbo].[ users] ([u ser_id]) | |
| 424 | END | |
| 425 | ||
| 426 | IF NOT EXISTS (SE LECT * FRO M sys.fore ign_keys W HERE objec t_id = OBJ ECT_ID(N'[ dbo].[FK_c reated_by] ') AND par ent_object _id = OBJE CT_ID(N'[d bo].[flags ]')) | |
| 427 | BEGIN | |
| 428 | ALTER TA BLE [dbo]. [flags] CH ECK CONSTR AINT [FK_c reated_by] | |
| 429 | END | |
| 430 | ||
| 431 | IF NOT EXISTS (SE LECT * FRO M sys.fore ign_keys W HERE objec t_id = OBJ ECT_ID(N'[ dbo].[FK_m odified_by ]') AND pa rent_objec t_id = OBJ ECT_ID(N'[ dbo].[flag s]')) | |
| 432 | BEGIN | |
| 433 | ALTER TA BLE [dbo]. [flags] W ITH CHECK ADD CONSTR AINT [FK_m odified_by ] FOREIGN KEY([modif ied_by]) | |
| 434 | REFERENC ES [dbo].[ users] ([u ser_id]) | |
| 435 | END | |
| 436 | ||
| 437 | IF NOT EXISTS (SE LECT * FRO M sys.fore ign_keys W HERE objec t_id = OBJ ECT_ID(N'[ dbo].[FK_m odified_by ]') AND pa rent_objec t_id = OBJ ECT_ID(N'[ dbo].[flag s]')) | |
| 438 | BEGIN | |
| 439 | ALTER TA BLE [dbo]. [flags] CH ECK CONSTR AINT [FK_m odified_by ] | |
| 440 | END | |
| 441 | ||
| 442 | IF NOT E XISTS (SEL ECT * FROM sys.index es WHERE o bject_id = OBJECT_ID (N'[dbo].[ flags]') A ND name = N'IX_flags ') | |
| 443 | BEGIN | |
| 444 | CREATE C LUSTERED I NDEX [IX_f lags] ON [ dbo].[flag s] ([creat ed_by] ASC ) | |
| 445 | WITH (PA D_INDEX = OFF, STAT ISTICS_NOR ECOMPUTE = OFF, SOR T_IN_TEMPD B = OFF, I GNORE_DUP_ KEY = OFF, DROP_EXIS TING = OFF , ONLINE = OFF, ALLO W_ROW_LOCK S = ON, A LLOW_PAGE_ LOCKS = O N) ON [PRI MARY] | |
| 446 | END | |
| 447 | ", | |
| 448 | 'create_ logins' => " | |
| 449 | USE [".D ATABASE_NA ME."]; | |
| 450 | SET ANSI _NULLS ON | |
| 451 | SET QUOT ED_IDENTIF IER ON | |
| 452 | SET ANSI _PADDING O N | |
| 453 | ||
| 454 | IF NOT E XISTS (SEL ECT * FROM sys.objec ts WHERE o bject_id = OBJECT_ID (N'[dbo].[ logins]') AND type i n (N'U')) | |
| 455 | BEGIN | |
| 456 | CREATE T ABLE [dbo] .[logins]( | |
| 457 | [id] [bigi nt] IDENTI TY(1,1) NO T NULL, | |
| 458 | [session_i d] [nvarch ar](50) NU LL, | |
| 459 | [username] [varchar] (50) NULL, | |
| 460 | [ip_addres s] [nvarch ar](50) NU LL, | |
| 461 | [login_tim e] [bigint ] NULL, | |
| 462 | [success] [tinyint] NOT NULL, | |
| 463 | [error_msg ] [nvarcha r](max) NU LL, | |
| 464 | CONSTRA INT [PK_lo gins] PRIM ARY KEY CL USTERED ([ id] ASC) | |
| 465 | WITH (PA D_INDEX = OFF, STAT ISTICS_NOR ECOMPUTE = OFF, IGN ORE_DUP_KE Y = OFF, A LLOW_ROW_L OCKS = ON , ALLOW_PA GE_LOCKS = ON) ON [ PRIMARY]) ON [PRIMAR Y] | |
| 466 | SET ANSI _PADDING O FF | |
| 467 | END | |
| 468 | ", | |
| 469 | 'create_ mail_log' => " | |
| 470 | USE [".DAT ABASE_NAME ."]; | |
| 471 | SET ANSI_N ULLS ON | |
| 472 | SET QUOTED _IDENTIFIE R ON | |
| 473 | SET ANSI_P ADDING ON | |
| 474 | ||
| 475 | IF NOT EXI STS (SELEC T * FROM s ys.objects WHERE obj ect_id = O BJECT_ID(N '[dbo].[ma il_log]') AND type i n (N'U')) | |
| 476 | BEGIN | |
| 477 | CREATE TAB LE [dbo].[ mail_log]( | |
| 478 | [i d] [bigint ] IDENTITY (1,1) NOT NULL, | |
| 479 | [t ime] [bigi nt] NULL, | |
| 480 | [s ize] [bigi nt] NULL, | |
| 481 | [s ender] [va rchar](max ) NULL, | |
| 482 | [r ecipient] [varchar]( max) NULL, | |
| 483 | [a ttachment_ types] [nv archar](ma x) NULL, | |
| 484 | [s uccess] [t inyint] NO T NULL, | |
| 485 | [i nbound_out bound] [ti nyint] NOT NULL, | |
| 486 | CONSTRAIN T [PK_mail _log] PRIM ARY KEY CL USTERED ([ id] ASC) | |
| 487 | WITH (PAD_ INDEX = O FF, STATIS TICS_NOREC OMPUTE = OFF, IGNOR E_DUP_KEY = OFF, ALL OW_ROW_LOC KS = ON, ALLOW_PAGE _LOCKS = ON) ON [PR IMARY]) ON [PRIMARY] | |
| 488 | SET ANSI_P ADDING OFF | |
| 489 | END | |
| 490 | ", | |
| 491 | 'create_ requests' => " | |
| 492 | USE [".DAT ABASE_NAME ."]; | |
| 493 | SET ANSI_N ULLS ON | |
| 494 | SET QUOTED _IDENTIFIE R ON | |
| 495 | SET ANSI_P ADDING ON | |
| 496 | ||
| 497 | IF NOT EXI STS (SELEC T * FROM s ys.objects WHERE obj ect_id = O BJECT_ID(N '[dbo].[re quests]') AND type i n (N'U')) | |
| 498 | BEGIN | |
| 499 | CREATE TAB LE [dbo].[ requests]( | |
| 500 | [r equest_id] [bigint] IDENTITY(1 ,1) NOT NU LL, | |
| 501 | [u ser_name] [nvarchar] (max) NOT NULL, | |
| 502 | [u ser_edipi] [bigint] NULL, | |
| 503 | [r equest_dat e] [bigint ] NOT NULL , | |
| 504 | [f irst_name] [varchar] (max) NULL , | |
| 505 | [m iddle_name ] [varchar ](max) NUL L, | |
| 506 | [l ast_name] [varchar]( max) NULL, | |
| 507 | [o rganizatio n] [nvarch ar](max) N ULL, | |
| 508 | [d epartment] [nvarchar ](max) NUL L, | |
| 509 | [t elephone] [nvarchar] (50) NULL, | |
| 510 | [m ail] [nvar char](max) NOT NULL, | |
| 511 | [t itle] [nva rchar](max ) NULL, | |
| 512 | [a pproved_fl ag] [tinyi nt] NOT NU LL, | |
| 513 | [c reated_fla g] [tinyin t] NOT NUL L, | |
| 514 | [d enied_flag ] [tinyint ] NOT NULL , | |
| 515 | [u ser_piv_id ] [bigint] NULL, | |
| 516 | CONSTRAIN T [PK_requ ests] PRIM ARY KEY CL USTERED ([ request_id ] ASC) | |
| 517 | WITH (PAD_ INDEX = O FF, STATIS TICS_NOREC OMPUTE = OFF, IGNOR E_DUP_KEY = OFF, ALL OW_ROW_LOC KS = ON, ALLOW_PAGE _LOCKS = ON) ON [PR IMARY]) ON [PRIMARY] | |
| 518 | END | |
| 519 | SET ANSI_P ADDING OFF | |
| 520 | ", | |
| 521 | 'create_ sessions' => " | |
| 522 | USE [".DAT ABASE_NAME ."]; | |
| 523 | SET ANSI_N ULLS ON | |
| 524 | SET QUOTED _IDENTIFIE R ON | |
| 525 | SET ANSI_P ADDING ON | |
| 526 | ||
| 527 | IF NOT EXI STS (SELEC T * FROM s ys.objects WHERE obj ect_id = O BJECT_ID(N '[dbo].[se ssions]') AND type i n (N'U')) | |
| 528 | BEGIN | |
| 529 | CREATE TAB LE [dbo].[ sessions]( | |
| 530 | [s ession_id] [varchar] (50) NOT N ULL, | |
| 531 | [i p_address] [varchar] (50) NOT N ULL, | |
| 532 | [u ser_agent] [varchar] (max) NOT NULL, | |
| 533 | [l ast_activi ty] [int] NOT NULL, | |
| 534 | [u ser_data] [text] NUL L, | |
| 535 | CONSTRAIN T [PK_sess ions] PRIM ARY KEY CL USTERED ([ session_id ] ASC) | |
| 536 | WITH (PAD _INDEX = OFF, STATI STICS_NORE COMPUTE = OFF, IGNO RE_DUP_KEY = OFF, AL LOW_ROW_LO CKS = ON, ALLOW_PAG E_LOCKS = ON) ON [P RIMARY]) O N [PRIMARY ] TEXTIMAG E_ON [PRIM ARY] | |
| 537 | END | |
| 538 | SET ANSI_P ADDING OFF | |
| 539 | ", | |
| 540 | 'create_ themes' => " | |
| 541 | USE [".D ATABASE_NA ME."]; | |
| 542 | SET ANSI _NULLS ON | |
| 543 | SET QUOT ED_IDENTIF IER ON | |
| 544 | ||
| 545 | IF NOT E XISTS (SEL ECT * FROM sys.objec ts WHERE o bject_id = OBJECT_ID (N'[dbo].[ themes]') AND type i n (N'U')) | |
| 546 | BEGIN | |
| 547 | CREATE T ABLE [dbo] .[themes]( | |
| 548 | [theme_id] [bigint] IDENTITY(1 ,1) NOT NU LL, | |
| 549 | [theme_css _name] [nv archar](50 ) NOT NULL , | |
| 550 | [theme_dis play_name] [text] NO T NULL, | |
| 551 | [theme_pre view_bg] [ nvarchar]( max) NOT N ULL, | |
| 552 | [theme_ban ner_img] [ nvarchar]( max) NOT N ULL, | |
| 553 | [theme_ban ner_alt_te xt] [nvarc har](max) NOT NULL, | |
| 554 | [theme_is_ default] [ tinyint] N ULL, | |
| 555 | CONSTRA INT [PK_th emes] PRIM ARY KEY CL USTERED ([ theme_id] ASC) | |
| 556 | WITH (PA D_INDEX = OFF, STAT ISTICS_NOR ECOMPUTE = OFF, IGN ORE_DUP_KE Y = OFF, A LLOW_ROW_L OCKS = ON , ALLOW_PA GE_LOCKS = ON) ON [ PRIMARY]) ON [PRIMAR Y] TEXTIMA GE_ON [PRI MARY] | |
| 557 | SET IDEN TITY_INSER T [dbo].[t hemes] ON | |
| 558 | INSERT [ dbo].[them es] ([them e_id], [th eme_css_na me], [them e_display_ name], [th eme_previe w_bg], [th eme_banner _img], [th eme_banner _alt_text] , [theme_i s_default] ) VALUES ( 1, N'va', N'VA direc t Project' , N'#1174A B', N'bann er_va.png' , N'VA Dir ect- Simpl e, Secure Health Mes saging', 1 ) | |
| 559 | SET IDEN TITY_INSER T [dbo].[t hemes] OFF | |
| 560 | END | |
| 561 | ", | |
| 562 | 'create_ users' => " | |
| 563 | USE [".D ATABASE_NA ME."]; | |
| 564 | SET ANSI _NULLS ON | |
| 565 | SET QUOT ED_IDENTIF IER ON | |
| 566 | ||
| 567 | IF NOT E XISTS (SEL ECT * FROM sys.objec ts WHERE o bject_id = OBJECT_ID (N'[dbo].[ users]') A ND type in (N'U')) | |
| 568 | BEGIN | |
| 569 | CREATE T ABLE [dbo] .[users]( | |
| 570 | [user_id] [bigint] I DENTITY(1, 1) NOT NUL L, | |
| 571 | [user_edip i] [bigint ] NULL, | |
| 572 | [user_name ] [nvarcha r](50) NOT NULL, | |
| 573 | [user_mail ] [nvarcha r](50) NUL L, | |
| 574 | [user_them e] [bigint ] NOT NULL , | |
| 575 | [user_ep] [nvarchar] (max) NOT NULL, | |
| 576 | [user_crea ted_by] [b igint] NOT NULL, | |
| 577 | [user_crea ted_date] [bigint] N OT NULL, | |
| 578 | [user_ext_ notify_fla g] [tinyin t] NOT NUL L, | |
| 579 | [user_ext_ group_noti fy_flag] [ tinyint] N OT NULL, | |
| 580 | [user_dele ted_flag] [tinyint] NOT NULL, | |
| 581 | [user_loca le] [nvarc har](max) NULL, | |
| 582 | [user_is_g roup] [tin yint] NOT NULL, | |
| 583 | [user_piv_ id] [bigin t] NULL, | |
| 584 | [default_m ailbox] [n varchar] ( 100) NULL, | |
| 585 | CONSTRA INT [PK_us ers2] PRIM ARY KEY CL USTERED ([ user_id] A SC) | |
| 586 | WITH (PA D_INDEX = OFF, STAT ISTICS_NOR ECOMPUTE = OFF, IGN ORE_DUP_KE Y = OFF, A LLOW_ROW_L OCKS = ON , ALLOW_PA GE_LOCKS = ON) ON [ PRIMARY], | |
| 587 | UNIQUE NONCLUSTER ED ([user_ name] ASC) | |
| 588 | WITH (PA D_INDEX = OFF, STAT ISTICS_NOR ECOMPUTE = OFF, IGN ORE_DUP_KE Y = OFF, A LLOW_ROW_L OCKS = ON , ALLOW_PA GE_LOCKS = ON) ON [ PRIMARY]) ON [PRIMAR Y] | |
| 589 | ALTER TA BLE users ADD UNIQUE (user_nam e) | |
| 590 | END | |
| 591 | ", | |
| 592 | 'create_ workflow_i tems' => " | |
| 593 | US E [".DATAB ASE_NAME." ]; | |
| 594 | SE T ANSI_NUL LS ON | |
| 595 | SE T QUOTED_I DENTIFIER ON | |
| 596 | SE T ANSI_PAD DING ON | |
| 597 | ||
| 598 | IF NOT EXIST S (SELECT * FROM sys .objects W HERE objec t_id = OBJ ECT_ID(N'[ dbo].[work flow_items ]') AND ty pe in (N'U ')) | |
| 599 | BE GIN | |
| 600 | CR EATE TABLE [dbo].[wo rkflow_ite ms]( | |
| 601 | [id] [bigint] IDENTITY(1 ,1) NOT NU LL, | |
| 602 | [mes sage_id] [ bigint] NO T NULL, | |
| 603 | [mai lbox_group ] [nvarcha r](50) NOT NULL, | |
| 604 | [ass igned_to] [bigint], | |
| 605 | [com plete] [ti nyint] NOT NULL DEFA ULT 0, | |
| 606 | [cre ated_by] [ bigint] NO T NULL, | |
| 607 | [mod ified_by] [bigint] N OT NULL, | |
| 608 | [cre ated_at] [ bigint] NO T NULL, | |
| 609 | [mod ified_at] [bigint] N OT NULL, | |
| 610 | C ONSTRAINT [PK_workfl ow_flag] P RIMARY KEY NONCLUSTE RED ([id] ASC) | |
| 611 | WI TH (PAD_IN DEX = OFF , STATISTI CS_NORECOM PUTE = OF F, IGNORE_ DUP_KEY = OFF, ALLOW _ROW_LOCKS = ON, AL LOW_PAGE_L OCKS = ON ) ON [PRIM ARY]) ON [ PRIMARY] | |
| 612 | EN D | |
| 613 | SE T ANSI_PAD DING OFF | |
| 614 | ||
| 615 | IF NOT EXIS TS (SELECT * FROM sy s.foreign_ keys WHERE object_id = OBJECT_ ID(N'[dbo] .[FK_workf low_mailbo x_group]') AND paren t_object_i d = OBJECT _ID(N'[dbo ].[workflo w_items]') ) | |
| 616 | BE GIN | |
| 617 | AL TER TABLE [dbo].[wor kflow_item s] WITH C HECK ADD C ONSTRAINT [FK_workfl ow_mailbox _group] | |
| 618 | FORE IGN KEY([m ailbox_gro up]) | |
| 619 | REFE RENCES [db o].[users] ([user_na me]) | |
| 620 | AL TER TABLE [dbo].[wor kflow_item s] CHECK C ONSTRAINT [FK_workfl ow_mailbox _group] | |
| 621 | EN D | |
| 622 | ||
| 623 | IF NOT EXIS TS (SELECT * FROM sy s.foreign_ keys WHERE object_id = OBJECT_ ID(N'[dbo] .[FK_workf low_assign ed_to]') A ND parent_ object_id = OBJECT_I D(N'[dbo]. [workflow_ items]')) | |
| 624 | BE GIN | |
| 625 | AL TER TABLE [dbo].[wor kflow_item s] WITH C HECK ADD C ONSTRAINT [FK_workfl ow_assigne d_to] | |
| 626 | FORE IGN KEY([a ssigned_to ]) | |
| 627 | REFE RENCES [db o].[users] ([user_id ]) | |
| 628 | AL TER TABLE [dbo].[wor kflow_item s] CHECK C ONSTRAINT [FK_workfl ow_assigne d_to] | |
| 629 | EN D | |
| 630 | ||
| 631 | ||
| 632 | IF NOT EXIS TS (SELECT * FROM sy s.foreign_ keys WHERE object_id = OBJECT_ ID(N'[dbo] .[FK_workf low_create d_by]') AN D parent_o bject_id = OBJECT_ID (N'[dbo].[ workflow_i tems]')) | |
| 633 | BE GIN | |
| 634 | AL TER TABLE [dbo].[wor kflow_item s] WITH C HECK ADD C ONSTRAINT [FK_workfl ow_created _by] | |
| 635 | FORE IGN KEY([c reated_by] ) | |
| 636 | REFE RENCES [db o].[users] ([user_id ]) | |
| 637 | AL TER TABLE [dbo].[wor kflow_item s] CHECK C ONSTRAINT [FK_workfl ow_created _by] | |
| 638 | EN D | |
| 639 | ||
| 640 | IF NOT EXIS TS (SELECT * FROM sy s.foreign_ keys WHERE object_id = OBJECT_ ID(N'[dbo] .[FK_workf low_modifi ed_by]') A ND parent_ object_id = OBJECT_I D(N'[dbo]. [workflow_ items]')) | |
| 641 | BE GIN | |
| 642 | AL TER TABLE [dbo].[wor kflow_item s] WITH C HECK ADD C ONSTRAINT [FK_workfl ow_modifie d_by] | |
| 643 | FORE IGN KEY([m odified_by ]) | |
| 644 | REFE RENCES [db o].[users] ([user_id ]) | |
| 645 | ||
| 646 | AL TER TABLE [dbo].[wor kflow_item s] CHECK C ONSTRAINT [FK_workfl ow_modifie d_by] | |
| 647 | EN D | |
| 648 | ", | |
| 649 | 'create_ admin_cont act_list' => " | |
| 650 | USE [".DATABAS E_NAME."] | |
| 651 | SET ANSI_NULLS ON | |
| 652 | SET QUOTED_IDE NTIFIER ON | |
| 653 | SET ANSI_PADDI NG ON | |
| 654 | CREA TE TABLE [ dbo].[admi n_contact_ list]( | |
| 655 | [conta ct_id] [bi gint] IDEN TITY(1,1) NOT NULL, | |
| 656 | [first _name] [nv archar](ma x) NOT NUL L, | |
| 657 | [middl e_name] [n varchar](m ax) NULL, | |
| 658 | [last_ name] [nva rchar](max ) NOT NULL , | |
| 659 | [title ] [nvarcha r](max) NU LL, | |
| 660 | [depar tment] [nv archar](ma x) NULL, | |
| 661 | [organ ization] [ nvarchar]( max) NULL, | |
| 662 | [telep hone] [nva rchar](50) NULL, | |
| 663 | [shari ng] [nvarc har](max) NULL, | |
| 664 | [direc t_address] [nvarchar ](max) NOT NULL, | |
| 665 | [mobil e] [nvarch ar](50) NU LL, | |
| 666 | [modif ied_by] [b igint] NUL L, | |
| 667 | [modif ied_at] [b igint] NUL L, | |
| 668 | CON STRAINT [P K_admin_co ntact_list ] PRIMARY KEY CLUSTE RED ([cont act_id] AS C) WITH (P AD_INDEX = OFF, STA TISTICS_NO RECOMPUTE = OFF, IG NORE_DUP_K EY = OFF, ALLOW_ROW_ LOCKS = O N, ALLOW_P AGE_LOCKS = ON) ON [PRIMARY]) ON [PRIMA RY] | |
| 669 | SET ANSI_PADDI NG OFF | |
| 670 | IF N OT EXISTS (SELECT * FROM sys.f oreign_key s WHERE ob ject_id = OBJECT_ID( N'[dbo].[F K_modified _by]') AND parent_ob ject_id = OBJECT_ID( N'[dbo].[a dmin_conta ct_list]') ) | |
| 671 | BEGI N | |
| 672 | ALTE R TABLE [d bo].[admin _contact_l ist] WITH CHECK ADD CONSTRAI NT [FK_mod ified_by_u sers] FORE IGN KEY([m odified_by ]) | |
| 673 | REFERE NCES [dbo] .[users] ( [user_id]) | |
| 674 | END | |
| 675 | ", | |
| 676 | 'create_ das_result s' => " | |
| 677 | USE [".DAT ABASE_NAME ."] | |
| 678 | SET ANSI_N ULLS ON | |
| 679 | SET QUOTED _IDENTIFIE R ON | |
| 680 | CREATE TAB LE [dbo].[ das_result s]( | |
| 681 | [i d] [bigint ] IDENTITY (1,1) NOT NULL, | |
| 682 | [c reated_by] [nvarchar ](max) NUL L, | |
| 683 | [s aved_date] [bigint] NULL, | |
| 684 | [r esult_stat us] [nchar ](10) NULL , | |
| 685 | [a ttachment_ name] [nva rchar](max ) NULL, | |
| 686 | [h ash_attach ment_name] [nvarchar ](512) NUL L, | |
| 687 | [d as_documen t_id] [nva rchar](max ) NULL, | |
| 688 | [m essage_id] [bigint] NULL, | |
| 689 | CO NSTRAINT [ PK_das_res ults] PRIM ARY KEY CL USTERED ([ id] ASC) W ITH (PAD_I NDEX = OF F, STATIST ICS_NORECO MPUTE = O FF, IGNORE _DUP_KEY = OFF, ALLO W_ROW_LOCK S = ON, A LLOW_PAGE_ LOCKS = O N) ON [PRI MARY]) ON [PRIMARY] | |
| 690 | ", | |
| 691 | 'create_ archive_se ttings' => " | |
| 692 | USE [".DATABAS E_NAME."] | |
| 693 | SET ANSI_NULLS ON | |
| 694 | SET QUOTED_IDE NTIFIER ON | |
| 695 | SET ANSI_PADDI NG ON | |
| 696 | CREA TE TABLE [ dbo].[arch ive_settin gs]( | |
| 697 | [id] [ bigint] ID ENTITY(1,1 ) NOT NULL , | |
| 698 | [frequ ency] [var char](200) NOT NULL, | |
| 699 | [archi ve_age] [i nt] NOT NU LL, | |
| 700 | [last_ execution_ time] [big int] NOT N ULL, | |
| 701 | [archi ve_age_uni t] [nvarch ar](200) N OT NULL, | |
| 702 | CONS TRAINT [PK _archive_s ettings] P RIMARY KEY CLUSTERED ([id] ASC ) WITH (PA D_INDEX = OFF, STAT ISTICS_NOR ECOMPUTE = OFF, IGN ORE_DUP_KE Y = OFF, A LLOW_ROW_L OCKS = ON , ALLOW_PA GE_LOCKS = ON) ON [ PRIMARY]) ON [PRIMAR Y] | |
| 703 | SET ANSI_PADDI NG OFF | |
| 704 | SET IDENTITY_I NSERT [dbo ].[archive _settings] ON | |
| 705 | INSE RT [dbo].[ archive_se ttings] ([ id], [freq uency], [a rchive_age ], [last_e xecution_t ime]) VALU ES (1, N'd aily', 1, 1406180060 ) | |
| 706 | SET IDENTITY_I NSERT [dbo ].[archive _settings] OFF | |
| 707 | ", | |
| 708 | 'create_ response' => "USE [" .DATABASE_ NAME."] | |
| 709 | SET ANSI_NULLS ON | |
| 710 | SET QUOTED_IDE NTIFIER ON | |
| 711 | CREA TE TABLE [ dbo].[resp onse]( | |
| 712 | [id] [ bigint] ID ENTITY(1,1 ) NOT NULL , | |
| 713 | [messa ge_id] [bi gint] NOT NULL, | |
| 714 | [paren t_id] [big int] NOT N ULL, | |
| 715 | [type] [nvarchar ](10) NOT NULL, | |
| 716 | CON STRAINT [P K_response ] PRIMARY KEY CLUSTE RED | |
| 717 | ( | |
| 718 | [id] A SC | |
| 719 | )WIT H (PAD_IND EX = OFF, STATISTIC S_NORECOMP UTE = OFF , IGNORE_D UP_KEY = O FF, ALLOW_ ROW_LOCKS = ON, ALL OW_PAGE_LO CKS = ON) ON [PRIMA RY] | |
| 720 | ) ON [PRIMARY] | |
| 721 | ||
| 722 | ", | |
| 723 | 'create_ announceme nts' => " | |
| 724 | USE [".D ATABASE_NA ME."] | |
| 725 | SET ANSI _NULLS ON | |
| 726 | SET QUOT ED_IDENTIF IER ON | |
| 727 | SET ANSI _PADDING O N | |
| 728 | ||
| 729 | IF NOT E XISTS (SEL ECT * FROM sys.objec ts WHERE o bject_id = OBJECT_ID (N'[dbo].[ announceme nts]') AND type in ( N'U')) | |
| 730 | BEGIN | |
| 731 | USE [".D ATABASE_NA ME."] | |
| 732 | CREATE T ABLE [dbo] .[announce ments]( | |
| 733 | [id] [bigi nt] IDENTI TY(1,1) NO T NULL, | |
| 734 | [enabled] [bit] NULL , | |
| 735 | [content] [nvarchar] (1000) NUL L, | |
| 736 | [updated_a t] [bigint ] NULL, | |
| 737 | [updated_b y] [bigint ] NULL, | |
| 738 | CONSTRA INT [PK_an nouncement s] PRIMARY KEY NONCL USTERED ([ id] ASC) | |
| 739 | WITH (P AD_INDEX = OFF, STA TISTICS_NO RECOMPUTE = OFF, IG NORE_DUP_K EY = OFF, ALLOW_ROW_ LOCKS = O N, ALLOW_P AGE_LOCKS = ON) ON [PRIMARY]) | |
| 740 | ON [PRI MARY] | |
| 741 | END | |
| 742 | SET ANSI _PADDING O FF | |
| 743 | SET IDEN TITY_INSER T [dbo].[a nnouncemen ts] ON | |
| 744 | INSERT [ dbo].[anno uncements] ([id], [c ontent], [ enabled], [updated_a t], [updat ed_by]) VA LUES (1,NU LL,0,NULL, NULL) | |
| 745 | SET IDEN TITY_INSER T [dbo].[a nnouncemen ts] OFF | |
| 746 | IF NOT E XISTS (SEL ECT * FROM sys.forei gn_keys WH ERE object _id = OBJE CT_ID(N'[d bo].[FK_up dated_by]' ) AND pare nt_object_ id = OBJEC T_ID(N'[db o].[announ cements]') ) | |
| 747 | BEGIN | |
| 748 | ALTER TA BLE [dbo]. [announcem ents] WIT H CHECK AD D CONSTRA INT [FK_up dated_by_u sers] FORE IGN KEY([u pdated_by] ) | |
| 749 | REFERENC ES [dbo].[ users] ([u ser_id]) | |
| 750 | END | |
| 751 | ", | |
| 752 | 'creat e_global_c ontacts_sh ared' => " | |
| 753 | USE [".D ATABASE_NA ME."] | |
| 754 | SET ANSI _NULLS ON | |
| 755 | SET QUOT ED_IDENTIF IER ON | |
| 756 | SET ANSI _PADDING O N | |
| 757 | ||
| 758 | IF NOT E XISTS (SEL ECT * FROM sys.objec ts WHERE o bject_id = OBJECT_ID (N'[dbo].[ global_con tacts_shar ed]') AND type in (N 'U')) | |
| 759 | BEGIN | |
| 760 | USE [".D ATABASE_NA ME."] | |
| 761 | CREATE T ABLE [dbo] .[global_c ontacts_sh ared]( | |
| 762 | [contact_i d] [bigint ] NOT NULL CONSTRAIN T FK_share d_global_c ontacts FO REIGN KEY references dbo.admin _contact_l ist (conta ct_id), | |
| 763 | [user_id] [bigint] N OT NULL CO NSTRAINT F K_global_c ontacts_sh ared_with_ users FORE IGN KEY re ferences d bo.users ( user_id), | |
| 764 | ||
| 765 | CONSTRA INT shared _global_co ntacts_uni que UNIQUE (contact_i d, user_id ) | |
| 766 | WITH (P AD_INDEX = OFF, STA TISTICS_NO RECOMPUTE = OFF, IG NORE_DUP_K EY = OFF, ALLOW_ROW_ LOCKS = O N, ALLOW_P AGE_LOCKS = ON) ON [PRIMARY]) | |
| 767 | ON [PRI MARY] | |
| 768 | END | |
| 769 | SET ANSI _PADDING O FF | |
| 770 | ", | |
| 771 | ); | |
| 772 | $this- >ldap_sche ma = array ( | |
| 773 | LDAP_BAS E_DOMAIN = > array('o bjectClass ' => array ('dcObject ','organiz ation','to p'),'dc'=> '','o'=>'n odomain'), | |
| 774 | 'cn=admi n,'.LDAP_B ASE_DOMAIN => array( 'objectCla ss' => arr ay('organi zationalRo le','simpl eSecurityO bject'),'c n'=>'admin ','userPas sword' => '', 'descr iption' => 'LDAP Adm inistrator '), | |
| 775 | 'cn=doma ins,'.LDAP _BASE_DOMA IN => arra y('objectC lass' => ' organizati onalRole', 'cn' => ' domains'), | |
| 776 | 'cn=webm ailsearch, '.LDAP_BAS E_DOMAIN = > array('o bjectClass ' => array ('organiza tionalRole ','simpleS ecurityObj ect'),'cn' =>'webmail search','u serPasswor d' => '', 'descripti on' => 'Sy stem accou nt for ano nymous LDA P search') , | |
| 777 | 'ou=admi ns,'.LDAP_ BASE_DOMAI N => array ('objectCl ass' => 'g roupOfName s', 'cn' = > 'admins' , 'member' => 'cn=ad min,'.LDAP _BASE_DOMA IN, 'ou' = > 'admins' ), | |
| 778 | 'ou=dele tedaccount s,'.LDAP_B ASE_DOMAIN => array( 'objectCla ss' => arr ay('organi zationalUn it','top') ,'ou' => ' deletedacc ounts'), | |
| 779 | 'ou=dele teddistrib utionlists ,'.LDAP_BA SE_DOMAIN => array(' objectClas s' => arra y('organiz ationalUni t','top'), 'ou' => 'd eleteddist ributionli sts'), | |
| 780 | 'ou=dele tedgroups, '.LDAP_BAS E_DOMAIN = > array('o bjectClass ' => array ('organiza tionalUnit ','top'),' ou' => 'de letedgroup s'), | |
| 781 | 'ou=acco unts,'.LDA P_BASE_DOM AIN => arr ay('object Class' => array('org anizationa lUnit','to p'),'ou' = > 'account s'), | |
| 782 | 'ou=dist ributionli sts,'.LDAP _BASE_DOMA IN => arra y('objectC lass' => a rray('orga nizational Unit','top '),'ou' => 'distribu tionlists' ), | |
| 783 | 'ou=grou ps,'.LDAP_ BASE_DOMAI N => array ('objectCl ass' => ar ray('organ izationalU nit','top' ),'ou' => 'groups'), | |
| 784 | 'ou=pwpo licies,'.L DAP_BASE_D OMAIN => a rray('obje ctClass' = > array('o rganizatio nalUnit',' top'),'ou' => array( 'policies' ,'pwpolici es')), | |
| 785 | 'cn=defa ult,ou=pwp olicies,'. LDAP_BASE_ DOMAIN => array('obj ectClass' => array(' device','p wdPolicy') , 'cn' => 'default', 'pwdAttri bute' => ' 2.5.4.35', 'pwdAllow UserChange ' => 'FALS E', 'pwdEx pireWarnin g' => '360 0', 'pwdIn History' = > '5', 'pw dLockout' => 'TRUE', 'pwdLocko utDuration ' => '3600 ', 'pwdMax Age' => '5 184000', ' pwdMinLeng th' => '15 ', 'pwdMus tChange' = > 'TRUE', 'pwdSafeMo dify' => ' FALSE'), | |
| 786 | 'ou=role s,'.LDAP_B ASE_DOMAIN => array( 'objectCla ss' => arr ay('organi zationalUn it','top') ,'ou' => ' roles'), | |
| 787 | 'ou=faci lityleader ,ou=roles, '.LDAP_BAS E_DOMAIN = > array(' objectClas s' => 'gro upOfNames' ,'cn' => ' Facility L eader', 'm ember' => 'cn=admin, '.LDAP_BAS E_DOMAIN, 'ou' => 'g roupleader '), | |
| 788 | 'ou=grou pleader,ou =roles,'.L DAP_BASE_D OMAIN => a rray('obje ctClass' = > 'groupOf Names','cn ' => 'Grou p Leader', 'member' => 'cn=adm in,'.LDAP_ BASE_DOMAI N, 'ou' => 'facility leader'), | |
| 789 | ); | |
| 790 | } | |
| 791 | ||
| 792 | pu blic funct ion index( ) { | |
| 793 | $thi s->load_in stall_view (); | |
| 794 | } | |
| 795 | pu blic funct ion ldap() { | |
| 796 | $thi s->load_in stall_view ('ldap'); | |
| 797 | } | |
| 798 | pu blic funct ion databa se() { | |
| 799 | $thi s->load_in stall_view ('database '); | |
| 800 | } | |
| 801 | pu blic funct ion create _user() { | |
| 802 | $thi s->load_in stall_view ('create_u ser'); | |
| 803 | } | |
| 804 | ||
| 805 | pu blic funct ion create _db() { | |
| 806 | if($this-> input->pos t('sa_name ') && $thi s->input-> post(' AI ')) { | |
| 807 | $sa_na me = $this ->input->p ost('sa_na me',TRUE); | |
| 808 | $ AI = $this-> input->pos t(' AI ',TRUE); | |
| 809 | $this- >database_ config['UI D'] = $sa_ name; | |
| 810 | $this->dat abase_conf ig['PWD'] = $ AI ; | |
| 811 | } | |
| 812 | $con n = sqlsrv _connect($ this->data base_serve rname, $th is->databa se_config) ; | |
| 813 | if($ conn) { | |
| 814 | $query = $this-> database_q ueries['cr eate_'.DAT ABASE_NAME ]; | |
| 815 | $stmt = sqlsrv_q uery($conn , $query); | |
| 816 | $error s = array( ); | |
| 817 | if($st mt) { | |
| 818 | //check the entire query for errors, s ince it ha s multiple parts | |
| 819 | while(!i s_null(sql srv_next_r esult($stm t))) { | |
| 820 | $sql_error s = sqlsrv _errors(SQ LSRV_ERR_E RRORS); | |
| 821 | if(is_arra y($sql_err ors)) { | |
| 822 | fo reach($sql _errors as $error) { | |
| 823 | arra y_push($er rors, $err or); | |
| 824 | } | |
| 825 | } | |
| 826 | } | |
| 827 | } | |
| 828 | else { $errors = sqlsrv_er rors(SQLSR V_ERR_ERRO RS); } | |
| 829 | $this- >session-> set_flashd ata('creat e_db_error s', $error s); | |
| 830 | } | |
| 831 | if($ conn && $s tmt && emp ty($errors )) { | |
| 832 | foreac h($this->d atabase_sc hema as $t able => $c olumns) { | |
| 833 | $this->_ create_db_ table($tab le); | |
| 834 | } | |
| 835 | } | |
| 836 | redi rect('inst all/databa se'); | |
| 837 | } | |
| 838 | pu blic funct ion create _db_table( $table) { | |
| 839 | $thi s->_create _db_table( $table); | |
| 840 | redi rect('inst all/databa se'); | |
| 841 | } | |
| 842 | ||
| 843 | pu blic funct ion regene rate_passw ords(){ | |
| 844 | $thi s->load->d atabase(); | |
| 845 | $que ry = $this ->db->get( 'users'); | |
| 846 | if($ query){ | |
| 847 | $users = $query- >result(); | |
| 848 | echo " <h3>Regene rate Passw ords</h3>" ; | |
| 849 | foreac h ($users as $user){ | |
| 850 | $uid = $ user->user _name; | |
| 851 | $ep = $t his->rando m_password (); | |
| 852 | ||
| 853 | echo "<b r/>$uid: " ; | |
| 854 | if($this ->is_ascii ($ep)){ | |
| 855 | echo "Upda ting Datab ase"; | |
| 856 | $query = $ this->db-> query("UPD ATE users SET user_e p=".$this- >db->escap e($this->e ncrypt->en code($ep)) ." WHERE u ser_name=" . $this-> db->escape ($uid)); | |
| 857 | echo "..." ; | |
| 858 | if($query) { | |
| 859 | ec ho '<span style="col or:green"> OK</span>' ; | |
| 860 | ec ho '...Upd ating LDAP ...'; | |
| 861 | $l dap_conn = $this->pr epare_ldap _conn(); | |
| 862 | $l dap_bind = @ldap_bin d($ldap_co nn, LDAP_A DMIN_USERN AME, LDAP_ ADMIN_PASS WORD); | |
| 863 | if ($ldap_bin d) { | |
| 864 | $dn = 'uid='.$ uid.','.LD AP_ACCOUNT S_DN; | |
| 865 | if($ this->ldap _entry_exi sts($ldap_ conn, $dn) ) { | |
| 866 | $succe ss = ldap_ modify($ld ap_conn, $ dn, array( 'userPassw ord' => $t his->encry pt->ssha25 6_encode($ ep))); | |
| 867 | if($su ccess) { | |
| 868 | echo '<s pan style= "color:gre en">OK</sp an>'; | |
| 869 | } | |
| 870 | else { | |
| 871 | echo '<s pan style= "color:red ">Error: U nable to m odify LDAP account</ span>'; | |
| 872 | } | |
| 873 | } | |
| 874 | else { | |
| 875 | echo ' <span styl e="color:r ed">Error: Unable to locate LD AP account </span>'; | |
| 876 | } | |
| 877 | } | |
| 878 | el se { | |
| 879 | echo '<span st yle="color :red">Erro r: Unable to bind to LDAP</spa n>'; | |
| 880 | } | |
| 881 | } | |
| 882 | else { | |
| 883 | ec ho '<span style="col or:red">Er ror: Unabl e to find user in da tabase</sp an>'; | |
| 884 | } | |
| 885 | } | |
| 886 | } | |
| 887 | } | |
| 888 | else { | |
| 889 | echo " Could not get users" ; | |
| 890 | } | |
| 891 | echo '<br/><a href="/ins tall">Back </a>'; | |
| 892 | } | |
| 893 | ||
| 894 | pr ivate func tion _crea te_db_tabl e($table) { | |
| 895 | if($this-> input->pos t('sa_name ') && $thi s->input-> post(' AI ')) { | |
| 896 | $sa_na me = $this ->input->p ost('sa_na me',TRUE); | |
| 897 | $ AI = $this-> input->pos t(' AI ',TRUE); | |
| 898 | $this- >database_ config['UI D'] = $sa_ name; | |
| 899 | $this->dat abase_conf ig['PWD'] = $ AI ; | |
| 900 | } | |
| 901 | if(a rray_key_e xists($tab le, $this- >database_ schema)) { | |
| 902 | $conn = sqlsrv_c onnect($th is->databa se_servern ame, $this ->database _config); | |
| 903 | if($co nn) { | |
| 904 | $query = $this->da tabase_tab le_queries ['create_' .$table]; | |
| 905 | $stmt = sqlsrv_que ry($conn, $query); | |
| 906 | $errors = array(); | |
| 907 | if($stmt ) { | |
| 908 | //check th e entire q uery for e rrors, sin ce it has multiple p arts | |
| 909 | while(!is_ null(sqlsr v_next_res ult($stmt) )) { | |
| 910 | $s ql_errors = sqlsrv_e rrors(SQLS RV_ERR_ERR ORS); | |
| 911 | if (is_array( $sql_error s)) { | |
| 912 | fore ach($sql_e rrors as $ error) { | |
| 913 | array_ push($erro rs, $error ); | |
| 914 | } | |
| 915 | } | |
| 916 | } | |
| 917 | } | |
| 918 | else { | |
| 919 | $errors = sqlsrv_err ors(SQLSRV _ERR_ERROR S); | |
| 920 | } | |
| 921 | //if we found erro rs | |
| 922 | if(!empt y($errors) ) { | |
| 923 | $this->ses sion->set_ flashdata( $table.'_e rrors',$er rors); | |
| 924 | $this->ses sion->set_ flashdata( $table.'_q uery',$que ry); | |
| 925 | } | |
| 926 | } | |
| 927 | else { | |
| 928 | $this->s ession->se t_flashdat a($table.' _errors',s qlsrv_erro rs()); | |
| 929 | $this->s ession->se t_flashdat a($table.' _query',$q uery); | |
| 930 | } | |
| 931 | } | |
| 932 | else { | |
| 933 | $this- >session-> set_flashd ata($table .'_errors' ,'This tab le does no t exist in the confi gured sche ma.'); | |
| 934 | $this- >session-> set_flashd ata($table .'_query', $query); | |
| 935 | } | |
| 936 | } | |
| 937 | ||
| 938 | pr ivate func tion load_ install_vi ew($page = 'database ') { | |
| 939 | $thi s->load->h elper('for m_helper') ; | |
| 940 | $thi s->output- >append_ou tput(' | |
| 941 | <!doct ype html> | |
| 942 | <html> | |
| 943 | <head> | |
| 944 | <title>'.$ this->titl e.'</title > | |
| 945 | </head> | |
| 946 | <body> | |
| 947 | <div class ="wrapper" > | |
| 948 | <d iv class=" nav"> | |
| 949 | <a h ref="/inst all/databa se">Databa se</a> | |
| 950 | <a h ref="/inst all/ldap"> LDAP</a> | |
| 951 | <a h ref="/inst all/create _user">Cre ate User</ a> | |
| 952 | <a h ref="/inst all/regene rate_passw ords">Rege nerate Pas swords</a> | |
| 953 | <a h ref="/inst all/apply_ default_ma ilbox">Set Default M ailboxes</ a> | |
| 954 | <a h ref="/inst all/update _shared_gl obal_conta cts">Updat e Shared G lobal Cont acts</a> | |
| 955 | </ div> | |
| 956 | <d iv> | |
| 957 | '); | |
| 958 | if($ page === ' database') { | |
| 959 | $this- >output->a ppend_outp ut('<h2>Da tabase</h2 >'); | |
| 960 | $this- >output->a ppend_outp ut($this-> db_configu ration_tab le()); | |
| 961 | } | |
| 962 | else if($page === 'ldap' ) { | |
| 963 | $this- >output->a ppend_outp ut('<h2>LD AP</h2>'); | |
| 964 | $this- >output->a ppend_outp ut($this-> ldap_confi guration_t able()); | |
| 965 | } | |
| 966 | else if($page === 'creat e_user') { | |
| 967 | $this- >output->a ppend_outp ut('<h2>Cr eate User< /h2>'); | |
| 968 | $this- >output->a ppend_outp ut($this-> create_use r_form()); | |
| 969 | } | |
| 970 | $thi s->output- >append_ou tput(' | |
| 971 | </ div> | |
| 972 | </div> | |
| 973 | </body> | |
| 974 | </html > | |
| 975 | '); | |
| 976 | } | |
| 977 | ||
| 978 | pr ivate func tion ldap_ configurat ion_table( ) { | |
| 979 | $thi s->load->h elper('for m'); | |
| 980 | $out put = ''; | |
| 981 | $lda p_dns = ar ray(); | |
| 982 | $lda p_conn = $ this->prep are_ldap_c onn(); | |
| 983 | $lda p_bind = @ ldap_bind( $ldap_conn , LDAP_SEA RCH_USERNA ME, LDAP_S EARCH_PASS WORD); | |
| 984 | if($ ldap_bind) { | |
| 985 | $searc h = @ldap_ list($ldap _conn, $ba se_dn, '(o bjectClass =*)'); | |
| 986 | $resul t = @ldap_ get_entrie s($ldap_co nn, $searc h); | |
| 987 | $outpu t .= '<tab le style=" border: so lid black 1px;">'; | |
| 988 | $outpu t .= '<tr> <th>Requir ed LDAP Sc hema</th>< th>Status< /th></tr>' ; | |
| 989 | foreac h($this->l dap_schema as $dn => $values) { | |
| 990 | if($this ->ldap_ent ry_exists( $ldap_conn , $dn)) { | |
| 991 | $output .= '<tr><td style="col or: green; ">'.$dn.'< td><td sty le="color: green;">& #x2714;</t d></tr>'; | |
| 992 | } | |
| 993 | else { $ output .= '<tr><td s tyle="colo r: red;">' .$dn.'<td> <td style= "color: re d;">ɱ 7;</td><td >'.form_op en('/insta ll/create_ ldap_entry /'.rawurle ncode(base 64_encode( $dn))).for m_submit(' create','C reate').fo rm_close() .'</td></t r>'; } | |
| 994 | } | |
| 995 | $outpu t .= '</ta ble>'; | |
| 996 | } | |
| 997 | else { $output .= '<div style="max -width: 10 00px; back ground: #f ef1ec; bor der: solid 1px #900; border-ra dius: 5px; padding: 5px; margi n-bottom: 5px;">'.ld ap_error($ ldap_conn) .'</div>'; } | |
| 998 | retu rn $output ; | |
| 999 | } | |
| 1000 | ||
| 1001 | pu blic funct ion create _user_subm it() { | |
| 1002 | requ ire_model( 'user'); | |
| 1003 | ||
| 1004 | $use r_name = $ this->inpu t->post('u sername', TRUE); | |
| 1005 | ||
| 1006 | $fir st_name = $this->inp ut->post(' first_name ', TRUE); | |
| 1007 | $las t_name = $ this->inpu t->post('l ast_name', TRUE); | |
| 1008 | $use r_mail = $ this->inpu t->post('u ser_email' , TRUE); | |
| 1009 | ||
| 1010 | if(U SE_PIV_AUT H) | |
| 1011 | $user_ piv_id = $ this->inpu t->post('u ser_id', T RUE); | |
| 1012 | if(U SE_CAC_AUT H) | |
| 1013 | $user_ edipi = $ this->inpu t->post('u ser_id', T RUE); | |
| 1014 | ||
| 1015 | $use r = User:: create(com pact('user _name', 'u ser_mail', 'user_piv _id', 'use r_edipi')) ; | |
| 1016 | ||
| 1017 | if(U ser::is_an _entity($u ser)) { | |
| 1018 | $this- >session-> set_flashd ata('messa ges','Succ essfully c reated use r.'); | |
| 1019 | } | |
| 1020 | else { | |
| 1021 | $this- >session-> set_flashd ata('error s','Failed to create user.'); | |
| 1022 | } | |
| 1023 | redi rect('inst all'); | |
| 1024 | } | |
| 1025 | ||
| 1026 | pr ivate func tion creat e_user_for m() { | |
| 1027 | $out put = ''; | |
| 1028 | $thi s->load->h elper('for m'); | |
| 1029 | $out put .= for m_open('in stall/crea te_user_su bmit'); | |
| 1030 | $out put .= '<t able>'; | |
| 1031 | $out put .= '<t r><td>'.fo rm_label(' Username', 'username' ).'</td>'; | |
| 1032 | $out put .= '<t d>'.form_i nput(array ('id'=>'us ername','n ame'=>'use rname')).' </td>'; | |
| 1033 | $out put .= '<t d>'.form_l abel('ID', 'user_id') .'</td>'; | |
| 1034 | $out put .= '<t d>'.form_i nput(array ('id'=>'us er_id','na me'=>'user _id')).'</ td></tr>'; | |
| 1035 | $out put .= '<t r><td>'.fo rm_label(' First Name ','first_n ame').'</t d>'; | |
| 1036 | $out put .= '<t d>'.form_i nput(array ('id'=>'fi rst_name', 'name'=>'f irst_name' )).'</td>' ; | |
| 1037 | $out put .= '<t d>'.form_l abel('Last Name','la st_name'). '</td>'; | |
| 1038 | $out put .= '<t d>'.form_i nput(array ('id'=>'la st_name',' name'=>'la st_name')) .'</td></t r>'; | |
| 1039 | $out put .= '<t r><td>'.fo rm_label(' Email Addr ess','user _email').' </td>'; | |
| 1040 | $out put .= '<t d>'.form_i nput(array ('id'=>'us er_email', 'name'=>'u ser_email' )).'</td>< /tr>'; | |
| 1041 | $out put .= '</ table>'; | |
| 1042 | $out put .= for m_submit(' create_use r_submit', 'Create Us er'); | |
| 1043 | $out put .= for m_close(); | |
| 1044 | retu rn $output ; | |
| 1045 | } | |
| 1046 | ||
| 1047 | pr ivate func tion _db_c onnects() { | |
| 1048 | $con nects = FA LSE; | |
| 1049 | $con n = sqlsrv _connect($ this->data base_serve rname, $th is->databa se_config) ; | |
| 1050 | if($ conn) { | |
| 1051 | $conne cts = TRUE ; | |
| 1052 | sqlsrv _close($co nn); | |
| 1053 | } | |
| 1054 | else { | |
| 1055 | if(sql srv_errors ()) { | |
| 1056 | $this->s ession->se t_flashdat a('db_conn ects_error s', sqlsrv _errors()) ; | |
| 1057 | } | |
| 1058 | } | |
| 1059 | retu rn $connec ts; | |
| 1060 | } | |
| 1061 | ||
| 1062 | pr ivate func tion _db_e xists() { | |
| 1063 | $con n = sqlsrv _connect($ this->data base_serve rname, $th is->databa se_config) ; | |
| 1064 | if($ conn) { | |
| 1065 | $db_ex ist_query = "SELECT name FROM master.sys .databases WHERE nam e = N'".DA TABASE_NAM E."'"; | |
| 1066 | $stmt = sqlsrv_q uery($conn , $db_exis t_query, a rray(), ar ray('Scrol lable'=>'b uffered')) ; | |
| 1067 | if($st mt) { | |
| 1068 | $num_row s = sqlsrv _num_rows( $stmt); | |
| 1069 | if($num_ rows && ($ num_rows > 0)) { ret urn TRUE; } | |
| 1070 | //db doe s not exis t yet, or possibly w e don't ha ve permiss ions to se e it | |
| 1071 | else { r eturn FALS E; } | |
| 1072 | } | |
| 1073 | else { | |
| 1074 | $errors = array(); | |
| 1075 | foreach( sqlsrv_err ors() as $ error) { | |
| 1076 | array_push ($errors, $error); | |
| 1077 | } | |
| 1078 | $this->s ession->se t_flashdat a('db_exis ts_errors' , $errors) ; | |
| 1079 | } | |
| 1080 | } | |
| 1081 | retu rn FALSE; | |
| 1082 | } | |
| 1083 | ||
| 1084 | pr ivate func tion _db_p ermissions _set($data base = DAT ABASE_NAME , $user = DATABASE_U SERNAME, $ permission s = NULL) { | |
| 1085 | //if permissio ns to chec k are not provided b y the func tion call, set them from defau lts | |
| 1086 | $req uired_perm issions = empty($per missions) ? $this->d b_required _permissio ns : $perm issions; | |
| 1087 | $con n = sqlsrv _connect($ this->data base_serve rname, $th is->databa se_config) ; | |
| 1088 | if($ conn) { | |
| 1089 | $permi ssion_quer y = "USE [ ".$databas e."]; EXEC sp_helpro lemember"; | |
| 1090 | $stmt = sqlsrv_q uery($conn , $permiss ion_query) ; | |
| 1091 | if($st mt) { | |
| 1092 | do { | |
| 1093 | while($row = sqlsrv_ fetch_arra y($stmt)) { | |
| 1094 | if ($row['Mem berName'] === $user) { | |
| 1095 | if(a rray_key_e xists($row ['DbRole'] , $require d_permissi ons)) { | |
| 1096 | $requi red_permis sions[$row ['DbRole'] ] = TRUE; | |
| 1097 | } | |
| 1098 | } | |
| 1099 | } | |
| 1100 | } | |
| 1101 | while(sq lsrv_next_ result($st mt)); | |
| 1102 | } | |
| 1103 | else { | |
| 1104 | $this->s ession->se t_flashdat a('db_perm issions_se t_errors', sqlsrv_er rors()); | |
| 1105 | } | |
| 1106 | } | |
| 1107 | //if permissio ns are mis sing, set which ones are missi ng in flas hdata to d isplay | |
| 1108 | if(( in_array(F ALSE, $req uired_perm issions))) { | |
| 1109 | $missi ng_permiss ions = arr ay(); | |
| 1110 | foreac h($require d_permissi ons as $ke y => $perm ission) { | |
| 1111 | if(!$per mission) { array_pus h($missing _permissio ns, $key); } | |
| 1112 | } | |
| 1113 | $this- >session-> set_flashd ata('db_pe rmissions_ missing', $missing_p ermissions ); | |
| 1114 | } | |
| 1115 | retu rn !(in_ar ray(FALSE, $required _permissio ns)); | |
| 1116 | } | |
| 1117 | ||
| 1118 | pu blic funct ion db_con figuration _table() { | |
| 1119 | $thi s->load->h elper('for m'); | |
| 1120 | $out put = ''; | |
| 1121 | //ch eck databa se permiss ions / con nection / database e xistence | |
| 1122 | $db_ connected = $this->_ db_connect s(); | |
| 1123 | $db_ exists = $ this->_db_ exists(); | |
| 1124 | $per missions_s et = $this ->_db_perm issions_se t(DATABASE _NAME); | |
| 1125 | ||
| 1126 | //if connectio n calls fa ils | |
| 1127 | if(! $db_connec ted) { | |
| 1128 | $error s = $this- >session-> flashdata( 'db_connec ts_errors' ); | |
| 1129 | if($er rors) { | |
| 1130 | if(is_ar ray($error s)) { | |
| 1131 | foreach($e rrors as $ error) { | |
| 1132 | if (strpos('i s not able to access the datab ase "maste r" under t he current security context', $error['me ssage']) > = 0) { $pe rmission_i ssue = TRU E; } | |
| 1133 | $o utput .= ' <div style ="max-widt h: 1000px; backgroun d: #fef1ec ; border: solid 1px #900; bord er-radius: 5px; padd ing: 5px; margin-bot tom: 5px;" >'.$error[ 'message'] .'</div>'; | |
| 1134 | } | |
| 1135 | } | |
| 1136 | } | |
| 1137 | //if e rrors are missing (a nd there h ad to be s ome if we are here), flashdata is full | |
| 1138 | else { | |
| 1139 | $output .= '<div s tyle="max- width: 100 0px; backg round: #fe f1ec; bord er: solid 1px #900; border-rad ius: 5px; padding: 5 px; margin -bottom: 5 px;">Conne ction erro rs encount ered. Refr esh page f or more de tails.</di v>'; | |
| 1140 | } | |
| 1141 | //if t here is a permission s error wi th the mas ter db, we can't do anything r eally, giv e all the | |
| 1142 | //quer ies necess ary to set up the da tabase as raw text f or manual set-up | |
| 1143 | if(iss et($permis sion_issue ) && $perm ission_iss ue) { | |
| 1144 | $output .= '<div s tyle="max- width: 100 0px; backg round: #fe f1ec; bord er: solid 1px #900; border-rad ius: 5px; padding: 5 px; margin -bottom: 5 px;"> | |
| 1145 | A pe rmissions issue is p reventing retrieval of informa tion from the master database that will allow this script to determine if the re quired dat abase, tab les, and p ermissions | |
| 1146 | exis t for the configured user. Thi s is most likely due to securi ty restric tions that have been purposefu lly set in place. | |
| 1147 | Howe ver, it is not possi ble for th is script to proceed with auto mated set- up of the database. The querie s required to set up | |
| 1148 | the database h ave been p rovided be low for a database a dministrat or to set up manuall y. | |
| 1149 | </di v>'; | |
| 1150 | $output .= '<h3>Cr eate requi red databa ses</h3>'; | |
| 1151 | foreach( $this->dat abase_quer ies as $ke y => $quer y) { | |
| 1152 | if(strpos( 'create',$ key) >= 0) { | |
| 1153 | $o utput .= ' <pre>'.pre g_replace( '/[\t]+/', ' ',$query ).'</pre>' ; | |
| 1154 | } | |
| 1155 | } | |
| 1156 | $output .= '<h3>Cr eate requi red tables </h3>'; | |
| 1157 | foreach( $this->dat abase_tabl e_queries as $key => $query) { | |
| 1158 | if(strpos( 'create',$ key) >= 0) { | |
| 1159 | $o utput .= ' <pre>'.pre g_replace( '/[\t]+/', ' ',$query ).'</pre>' ; | |
| 1160 | } | |
| 1161 | } | |
| 1162 | } | |
| 1163 | } | |
| 1164 | //if db existe nce call f ails | |
| 1165 | if($ db_connect ed && !$db _exists) { | |
| 1166 | $error s = $this- >session-> flashdata( 'db_exists _errors') ? $this->s ession->fl ashdata('d b_exists_e rrors') : array(); | |
| 1167 | $creat e_errors = $this->se ssion->fla shdata('cr eate_db_er rors') ? $ this->sess ion->flash data('crea te_db_erro rs') : arr ay(); | |
| 1168 | $error s = array_ merge($err ors, $crea te_errors) ; | |
| 1169 | $error s = empty( $errors) ? FALSE : $ errors; | |
| 1170 | if($er rors) { | |
| 1171 | if(is_ar ray($error s)) { | |
| 1172 | foreach($e rrors as $ error) { | |
| 1173 | if (strpos('p ermission_ denied',st rtolower($ error['mes sage'])) > = 0) { | |
| 1174 | $per missions_i ssue = TRU E; | |
| 1175 | } | |
| 1176 | $o utput .= ' <div style ="max-widt h: 1000px; backgroun d: #fef1ec ; border: solid 1px #900; bord er-radius: 5px; padd ing: 5px; margin-bot tom: 5px;" >'.$error[ 'message'] .'</div>'; | |
| 1177 | } | |
| 1178 | } | |
| 1179 | } | |
| 1180 | //if t here was a permissio ns issue w hen creati ng the dat abase, all ow user to try other credentia ls | |
| 1181 | if(iss et($permis sions_issu e) && $per missions_i ssue) { | |
| 1182 | $output .= form_op en('instal l/create_d b') | |
| 1183 | .for m_label('P rivileged SQL User: ','sa_name ') | |
| 1184 | .for m_input(ar ray('name' =>'sa_name ','id'=>'s a_name')). '<br/>' | |
| 1185 | .form_labe l('Privile ged SQL Us er Passwor d: ',' AI ') | |
| 1186 | .form_pass word(array ('name'=>' AI ','id'=>' AI ')).'<br/> ' | |
| 1187 | .for m_submit(' create_db' ,'Create D atabase') | |
| 1188 | .for m_close(); | |
| 1189 | $output .= '<div>T o manually create da tabase <sp an style=" font-weigh t: bold;"> '.DATABASE _NAME.'</s pan> run t he followi ng query: <br />'; | |
| 1190 | $output .= '<pre>' .preg_repl ace('/[\t] +/',' ',$t his->datab ase_querie s['create_ '.DATABASE _NAME]).'< /pre></div >'; | |
| 1191 | } | |
| 1192 | else { | |
| 1193 | $output .= form_op en('instal l/create_d b').form_s ubmit('cre ate_db','C reate Data base').for m_close(); | |
| 1194 | } | |
| 1195 | } | |
| 1196 | //if the datab ase server connects, we know t he databas e exists, but the pe rmissions the config ured user has | |
| 1197 | //ar en't confi gured corr ectly | |
| 1198 | if($ db_connect ed && $db_ exists && !$permissi ons_set) { | |
| 1199 | $error s = $this- >session-> flashdata( 'db_permis sions_set_ errors'); | |
| 1200 | $missi ng_permiss ions = $th is->sessio n->flashda ta('db_per missions_m issing'); | |
| 1201 | if($er rors) { | |
| 1202 | if(is_ar ray($error s)) { | |
| 1203 | foreach($e rrors as $ error) { | |
| 1204 | if (strpos('n ot able to access da tabase "'. DATABASE_N AME.'"',$e rror['mess age']) >= 0) { | |
| 1205 | $add _user_quer y = 'USE [ '.DATABASE _NAME.']; CREATE USE R ['.DATAB ASE_USERNA ME.'] FROM LOGIN ['. DATABASE_U SERNAME.'] WITH DEFA ULT_SCHEMA =[dbo];'; | |
| 1206 | } | |
| 1207 | $o utput .= ' <div style ="max-widt h: 1000px; backgroun d: #fef1ec ; border: solid 1px #900; bord er-radius: 5px; padd ing: 5px; margin-bot tom: 5px;" >'.$error[ 'message'] .'</div>'; | |
| 1208 | if (isset($ad d_user_que ry)) { | |
| 1209 | $out put .= '<d iv style=" max-width: 1000px; b ackground: #fef1ec; border: so lid 1px #9 00; border -radius: 5 px; paddin g: 5px; ma rgin-botto m: 5px;">' | |
| 1210 | .'An error has been detected t hat may in dicate the configure d user log in has not yet been added to t he ' . DAT ABASE_NAME . ' as a user. ' | |
| 1211 | .'Use the following query to a dd the con figured lo gin user t o the data base: <br/ >' | |
| 1212 | .'<pre>'.$ add_user_q uery.'</pr e>' | |
| 1213 | .'</div>'; | |
| 1214 | } | |
| 1215 | } | |
| 1216 | } | |
| 1217 | } | |
| 1218 | //if e rrors are missing (a nd there h ad to be s ome if we are here), flashdata is full | |
| 1219 | else { | |
| 1220 | $output .= '<div s tyle="max- width: 100 0px; backg round: #fe f1ec; bord er: solid 1px #900; border-rad ius: 5px; padding: 5 px; margin -bottom: 5 px;">Permi ssions err ors encoun tered. Ref resh page for more d etails.</d iv>'; | |
| 1221 | } | |
| 1222 | if(!em pty($missi ng_permiss ions) && $ missing_pe rmissions) { | |
| 1223 | foreach( $missing_p ermissions as $permi ssion) { | |
| 1224 | $output .= '<div sty le="max-wi dth: 1000p x; backgro und: #fef1 ec; border : solid 1p x #900; bo rder-radiu s: 5px; pa dding: 5px ; margin-b ottom: 5px ;"> | |
| 1225 | The co nfigured u ser: '.DAT ABASE_USER NAME.' is missing th e '.$permi ssion.' ro le. | |
| 1226 | Use th e followin g query to grant the required role to th is user:<b r/> | |
| 1227 | <pre>U SE ['.DATA BASE_NAME. ']; EXEC s p_addrolem ember \'db _datareade r\', \''.D ATABASE_US ERNAME.'\' ;</pre> | |
| 1228 | </div> '; | |
| 1229 | } | |
| 1230 | } | |
| 1231 | } | |
| 1232 | //if the datab ase alread y exists, and the co nfigured u ser has pe rmissions needed for running t he app | |
| 1233 | //NO TE: permis sions chec king check s roles on ly, not al l permissi ons, user may still not be abl e to creat e tables | |
| 1234 | if($ db_connect ed && $db_ exists && $permissio ns_set) { | |
| 1235 | $this- >load->dat abase(); | |
| 1236 | foreac h($this->d atabase_sc hema as $t able => $c olumns) { | |
| 1237 | $errors = $this->s ession->fl ashdata($t able.'_err ors'); | |
| 1238 | $query = $this->se ssion->fla shdata($ta ble.'_quer y'); | |
| 1239 | if($erro rs) { | |
| 1240 | if(is_arra y($errors) ) { | |
| 1241 | fo reach($err ors as $er ror) { | |
| 1242 | $out put .= '<d iv style=" max-width: 1000px; b ackground: #fef1ec; border: so lid 1px #9 00; border -radius: 5 px; paddin g: 5px; ma rgin-botto m: 5px;">' .$error['m essage'].' </div>'; | |
| 1243 | } | |
| 1244 | } | |
| 1245 | } | |
| 1246 | //TABLE START | |
| 1247 | $output .= '<table style="bo rder: soli d black 1p x; border- collapse: collapse; margin-rig ht: 15px; margin-bot tom: 15px; width: 40 0px;">'; | |
| 1248 | ||
| 1249 | $tbl_che ck_query = 'SELECT * FROM INFO RMATION_SC HEMA.TABLE S WHERE TA BLE_TYPE=' .$this->db ->escape(' BASE TABLE ').' AND T ABLE_NAME= '.$this->d b->escape( $table); | |
| 1250 | $tbl_che ck = $this ->db->quer y($tbl_che ck_query); | |
| 1251 | //query to check t able exist ence works | |
| 1252 | if($tbl_ check) { | |
| 1253 | //if the t able does not exist | |
| 1254 | if($tbl_ch eck->num_r ows() <= 0 ) { | |
| 1255 | // check for errors fro m a previo usly run q uery | |
| 1256 | if ($errors) { | |
| 1257 | $per mission_is sue = FALS E; | |
| 1258 | fore ach($error s as $erro r) { | |
| 1259 | if(str pos('permi ssion deni ed', $erro r['message ']) >= 0) { $permiss ion_issue = TRUE; } | |
| 1260 | } | |
| 1261 | //if there was a permiss ions issue , offer a way to ent er better credential s | |
| 1262 | if($ permission _issue) { | |
| 1263 | $outpu t .= '<tr> <td>A perm issions is sue was de tected wit h the quer y, if more privilege d credenti als are av ailable, e nter them below.' | |
| 1264 | .for m_open('in stall/crea te_db_tabl e/'.$table ) | |
| 1265 | .for m_label('P rivileged SQL User: ','sa_name ') | |
| 1266 | .for m_input(ar ray('name' =>'sa_name ','id'=>'s a_name')). '<br/>' | |
| 1267 | .form_labe l('Privile ged SQL Us er Passwor d: ',' AI ') | |
| 1268 | .form_pass word(array ('name'=>' AI ','id'=>' AI ')).'<br/> ' | |
| 1269 | .for m_submit(' create_'.$ table,'Cre ate '.$tab le) | |
| 1270 | .for m_close(). '</td></tr >'; | |
| 1271 | } | |
| 1272 | //bu t also giv e the quer y to run m anually th rough SQL Management Studio | |
| 1273 | //sh ould pull query from flashdata if possib le to ensu re it is t he right o ne, but if that isn' t possible use the h ardcoded o ne for cre ate table | |
| 1274 | if(! isset($que ry) || !$q uery) { | |
| 1275 | $query = $this-> database_t able_queri es['create _'.$table] ; | |
| 1276 | } | |
| 1277 | $out put .= '<t r><td>To m anually cr eate table <span sty le="font-w eight: bol d;">' . $t able . '</ span> tabl e use the following query:</td ></tr>'; | |
| 1278 | $out put .= '<t r><td><pre style="ba ckground: #eee; widt h: 1000px; word-wrap : break-wo rd;">' . p reg_replac e('/[\t]+/ ',' ',$que ry) . '</p re></td></ tr>'; | |
| 1279 | } | |
| 1280 | el se { | |
| 1281 | $out put .= '<t r><th titl e="'.$tabl e.' does n ot exist" style="col or: red;"> ' . $table . '</th>< /tr>'; | |
| 1282 | $out put .= '<t r><td styl e="text-al ign: cente r;">'.form _open('ins tall/creat e_db_table /'.$table) .form_subm it('create _'.$table, 'Create '. $table).fo rm_close() .'</td></t r>'; | |
| 1283 | } | |
| 1284 | } | |
| 1285 | //if it do es exist | |
| 1286 | else { | |
| 1287 | $o utput .= ' <tr><th st yle="color : green;"> ' . $table . '</th>< th>Status< /th></tr>' ; | |
| 1288 | fo reach($col umns as $c olumn => $ type) { | |
| 1289 | $col _check_que ry = 'SELE CT * FROM sys.column s WHERE [n ame] = '.$ this->db-> escape($co lumn).' AN D object_i d = OBJECT _ID('.$thi s->db->esc ape($table ).')'; | |
| 1290 | $col _check = $ this->db-> query($col _check_que ry); | |
| 1291 | if($ col_check) { | |
| 1292 | $outpu t .= '<tr> '; | |
| 1293 | if($co l_check->n um_rows() <= 0) { | |
| 1294 | $output .= '<td st yle="color : red;">'. $column.' ['.$type.' ]</td>'; | |
| 1295 | $output .= '<td st yle="color : red; tex t-align: c enter;">&# x2717;</td >'; | |
| 1296 | } | |
| 1297 | else { | |
| 1298 | $output .= '<td st yle="color : green;"> '.$column. ' ['.$type .']</td>'; | |
| 1299 | $data_ty pe_query = 'SELECT D ATA_TYPE, CHARACTER_ MAXIMUM_LE NGTH FROM INFORMATIO N_SCHEMA.C OLUMNS IC WHERE TABL E_NAME='.$ this->db-> escape($ta ble).' AND COLUMN_NA ME='.$this ->db->esca pe($column ); | |
| 1300 | $data_ty pe_check = $this->db ->query($d ata_type_q uery); | |
| 1301 | if($data _type_chec k) { | |
| 1302 | if($col_ch eck->num_r ows() <= 0 ) { | |
| 1303 | ||
| 1304 | } | |
| 1305 | else { | |
| 1306 | $r esult = $d ata_type_c heck->resu lt_array(0 ); | |
| 1307 | $d ata_type = $result[0 ]['DATA_TY PE']; | |
| 1308 | $m ax_length = ($result [0]['CHARA CTER_MAXIM UM_LENGTH' ] === -1) ? 'max' : $result[0] ['CHARACTE R_MAXIMUM_ LENGTH']; | |
| 1309 | if ($data_typ e === $typ e || $data _type.'('. $max_lengt h.')' === $type) { | |
| 1310 | $out put .= '<t d style="c olor: gree n; text-al ign: cente r;">ɱ 3;</td>'; | |
| 1311 | } | |
| 1312 | el se { | |
| 1313 | $fix _col_query = 'ALTER TABLE '.$t able.' ALT ER COLUMN '.$column. ' '.$type; | |
| 1314 | $out put .= '<t d title="D ata Type M ismatch. C lick for a lter colum n query." onclick="a lert(" ;'.$fix_co l_query.'& quot;);" s tyle="text -align: ce nter; back ground: #f ee; border : solid #f 00 1px;">< span style ="color: r ed;">' 17;</span> </td>'; | |
| 1315 | } | |
| 1316 | } | |
| 1317 | } | |
| 1318 | } | |
| 1319 | } | |
| 1320 | else { | |
| 1321 | $outpu t .= '<td style="col or: gold;" >'.$column .' ['.$typ e.']</td>' ; | |
| 1322 | $outpu t .= '<td title="Cli ck for man ual column existence check que ry." oncli ck="alert( "'.$c ol_check_q uery.'&quo t;);" styl e="text-al ign: cente r; cursor: pointer;" ><span sty le="color: gold;">&# x26a0;</sp an> Query Failed</td >'; | |
| 1323 | } | |
| 1324 | $out put .= '</ tr>'; | |
| 1325 | } | |
| 1326 | } | |
| 1327 | } | |
| 1328 | //if que ry fails, may not ha ve the pro per permis sions | |
| 1329 | else { | |
| 1330 | $output .= '<tr><th style="col or: gold; text-align : center;" >⚠ Database C heck Faile d</th></tr >'; | |
| 1331 | $output .= '<tr><td> Manually e xecute que ry below t o check ex istence of <span sty le="font-w eight: bol d;">'.$tab le.'</span > table:</ td></tr>'; | |
| 1332 | $output .= '<tr><td> <pre>'.$tb l_check_qu ery.'</pre ></td></tr >'; | |
| 1333 | } | |
| 1334 | //TABLE END | |
| 1335 | $output .= '</tabl e>'; | |
| 1336 | } | |
| 1337 | } | |
| 1338 | retu rn $output ; | |
| 1339 | } | |
| 1340 | ||
| 1341 | pu blic funct ion create _ldap() { | |
| 1342 | ||
| 1343 | } | |
| 1344 | ||
| 1345 | pu blic funct ion create _ldap_entr y($dn) { | |
| 1346 | $dn = base64_d ecode(rawu rldecode($ dn)); | |
| 1347 | if(a rray_key_e xists($dn, $this->ld ap_schema) ) { | |
| 1348 | $this- >_create_l dap_entry( $dn); | |
| 1349 | } | |
| 1350 | redi rect('inst all/ldap') ; | |
| 1351 | } | |
| 1352 | ||
| 1353 | pr ivate func tion _crea te_ldap_en try($dn) { | |
| 1354 | $lda p_conn = $ this->prep are_ldap_c onn(); | |
| 1355 | $lda p_bind = @ ldap_bind( $ldap_conn , LDAP_ADM IN_USERNAM E, LDAP_AD MIN_PASSWO RD); | |
| 1356 | if($ ldap_bind) { | |
| 1357 | ldap_a dd($ldap_c onn, $dn, $this->lda p_schema[$ dn]); | |
| 1358 | } | |
| 1359 | else { | |
| 1360 | ||
| 1361 | } | |
| 1362 | } | |
| 1363 | ||
| 1364 | pr ivate func tion ldap_ entry_exis ts($ldap_c onn,$dn) { | |
| 1365 | $sea rch = @lda p_search($ ldap_conn, $dn, '(ob jectClass= *)'); | |
| 1366 | $res ult = @lda p_get_entr ies($ldap_ conn,$sear ch); | |
| 1367 | if($ result['co unt'] > 0) { return TRUE; } | |
| 1368 | retu rn FALSE; | |
| 1369 | } | |
| 1370 | ||
| 1371 | pr ivate func tion prepa re_ldap_co nn() { | |
| 1372 | $lda p_conn = l dap_connec t(LDAP_HOS TNAME, LDA P_PORT); | |
| 1373 | if(! ldap_set_o ption($lda p_conn, LD AP_OPT_PRO TOCOL_VERS ION, 3)) { return FA LSE; } | |
| 1374 | if(! ldap_set_o ption($lda p_conn, LD AP_OPT_REF ERRALS, 0) ) { return FALSE; } | |
| 1375 | retu rn $ldap_c onn; | |
| 1376 | } | |
| 1377 | ||
| 1378 | pr ivate func tion decod e_sha256($ data, $con fig_key = null) { | |
| 1379 | $dat a = base64 _decode($d ata); | |
| 1380 | if(e mpty($conf ig_key)) { | |
| 1381 | $key = hash('sha 256', conf ig_item('e ncryption_ key'), tru e); | |
| 1382 | } | |
| 1383 | else { | |
| 1384 | $key = hash('sha 256', $con fig_key, t rue); | |
| 1385 | } | |
| 1386 | ||
| 1387 | $dat a = $this- >encrypt-> remove_cip her_noise( $data,$key ); | |
| 1388 | ||
| 1389 | $ini t_size = m crypt_get_ iv_size(MC RYPT_RIJND AEL_256, M CRYPT_MODE _CBC); | |
| 1390 | if ( $init_size > strlen( $data)) | |
| 1391 | { | |
| 1392 | return FALSE; | |
| 1393 | } | |
| 1394 | $ini t_vect = s ubstr($dat a, 0, $ini t_size); | |
| 1395 | $dat a = substr ($data, $i nit_size); | |
| 1396 | retu rn mcrypt_ decrypt(MC RYPT_RIJND AEL_256, $ key, $data , MCRYPT_M ODE_CBC, $ init_vect) ; | |
| 1397 | } | |
| 1398 | ||
| 1399 | pr ivate func tion is_a scii( $str ing = '' ) { | |
| 1400 | $n um = 0; | |
| 1401 | wh ile( isset ( $string[ $num] ) ) { | |
| 1402 | if( ord( $string[$ num] ) & 0 x80 ) { | |
| 1403 | retu rn false; | |
| 1404 | } | |
| 1405 | $num++; | |
| 1406 | } | |
| 1407 | re turn true; | |
| 1408 | } | |
| 1409 | ||
| 1410 | /* This func tion gener ates a 32 character random str ing for us e as a pas sword, | |
| 1411 | * utilizing a mix of lower and upper case , numbers, and speci al charact ers. | |
| 1412 | * / | |
| 1413 | pr ivate func tion rando m_password () { | |
| 1414 | $cha rs = array ("a","b"," c","d","e" ,"f","g"," h","i","j" ,"k","l"," m","n","o" ,"p","q"," r","s","t" ,"u","v"," w","x","y" ,"z","A"," B","C","D" ,"E","F"," G","H","I" ,"J","K"," L","M","N" ,"O","P"," Q","R","S" ,"T","U"," V","W","X" ,"Y","Z"," 1","2","3" ,"4","5"," 6","7","8" ,"9","0"," !","@","#" ,"$","%"," ^","&","*" ,"(",")"," {","}","?" ); | |
| 1415 | $pas s = ""; | |
| 1416 | $cou nt = count ($chars); | |
| 1417 | for( $i = 0; $i < 32; $i+ +) { | |
| 1418 | $pass .= $chars[ abs(hexdec (bin2hex(o penssl_ran dom_pseudo _bytes(6)) )%$count)] ; | |
| 1419 | } | |
| 1420 | retu rn $pass; | |
| 1421 | } | |
| 1422 | ||
| 1423 | ||
| 1424 | pu blic funct ion apply_ default_ma ilbox(){ | |
| 1425 | $thi s->load->l ibrary('ld ap', array ('user'=> LDAP_SEARC H_USERNAME , 'pwd'=>L DAP_SEARCH _PASSWORD) ); | |
| 1426 | $thi s->load->l ibrary('va lidator', array(), ' is'); | |
| 1427 | $thi s->load->l ibrary('er ror'); | |
| 1428 | $thi s->load->d atabase(); | |
| 1429 | $thi s->load->h elper('deb ug'); | |
| 1430 | ||
| 1431 | requ ire_model( 'user'); | |
| 1432 | ||
| 1433 | echo '<h1>Appl y Default Mailbox</h 1>'; | |
| 1434 | echo '<p>This script che cks for an y users wh ose person al mailbox is hidden and who d o not have a default mailbox s et. Where possible, this scri pt will se t the defa ult mailbo x.</p>'; | |
| 1435 | ||
| 1436 | $use rs = User: :find(arra y('default _mailbox' => null)); | |
| 1437 | echo '<p>Begin ning check s for '.co unt($users ).' users who do not have a de fault mail box set .. .</p>'; | |
| 1438 | ||
| 1439 | $suc cess_count = 0; | |
| 1440 | $err or_count = 0; | |
| 1441 | fore ach($users as $user) { | |
| 1442 | if($us er->hide_p ersonal_ma ilbox()){ | |
| 1443 | if(empty ($user->ma ilbox_name s())){ | |
| 1444 | $this->err or->warnin g('Could n ot set def ault mailb ox for '.$ user->desc ribe().': User does not belong to any ma ilboxes'); | |
| 1445 | $error_cou nt++; | |
| 1446 | }else{ | |
| 1447 | $user->def ault_mailb ox = first _element($ user->mail box_names( )); | |
| 1448 | if($user-> save()) | |
| 1449 | $s uccess_cou nt++; | |
| 1450 | else{ | |
| 1451 | $t his->error ->warning( 'Cold not save defau lt mailbox for '.$us er->descri be().': an error occ urred whil e saving') ; | |
| 1452 | $e rror_count ++; | |
| 1453 | } | |
| 1454 | } | |
| 1455 | } | |
| 1456 | } | |
| 1457 | ||
| 1458 | $unc hanged_cou nt = count ($users) - $success_ count - $e rror_count ; | |
| 1459 | ||
| 1460 | $mes sage = ''; | |
| 1461 | if(! empty($suc cess_count )) | |
| 1462 | $messa ge = 'Succ essfully c hanged the default m ailbox for '.number_ as_text($s uccess_cou nt).' '.pl uralize_if _necessary ('user', $ success_co unt); | |
| 1463 | ||
| 1464 | if(! empty($err or_count)) | |
| 1465 | $messa ge .= 'Err ors occurr ed for '.n umber_as_t ext($error _count).' '.pluraliz e_if_neces sary('user ', $error_ count).'. Check the log for f urther det ails. '; | |
| 1466 | ||
| 1467 | $mes sage .= $u nchanged_c ount.'/'.c ount($user s).' users did not n eed any ch anges.'; | |
| 1468 | ||
| 1469 | echo '<p>Done! '.$messa ge.'</p>'; | |
| 1470 | } | |
| 1471 | ||
| 1472 | ||
| 1473 | pu blic funct ion update _shared_gl obal_conta cts(){ | |
| 1474 | $thi s->load->d atabase(); | |
| 1475 | $thi s->load->l ibrary('va lidator', array(), ' is'); | |
| 1476 | $thi s->load->h elper('deb ug'); | |
| 1477 | ||
| 1478 | requ ire_models ('user', ' global_con tact'); | |
| 1479 | ||
| 1480 | echo '<h1>Upda te Shared Global Con tacts</h1> '; | |
| 1481 | echo '<p>This script che cks for an y global c ontacts th at are cur rently sha red among users, and places th e existing values in to the adm in_contact _list tabl e.</p>'; | |
| 1482 | ||
| 1483 | Glob al_contact ::db()->wh ere('shari ng !=', nu ll); | |
| 1484 | $glo bal_contac ts = Globa l_contact: :find(); | |
| 1485 | ||
| 1486 | fore ach($globa l_contacts as $globa l_contact) { | |
| 1487 | ||
| 1488 | // bas ed on the fact that the sharin g column w as string of comma-s eperated u sernames | |
| 1489 | $share d_users = explode(', ', strip_f rom_beginn ing(',', $ global_con tact->shar ing)); | |
| 1490 | ||
| 1491 | echo ' <p>Updatin g shared c ontact inf ormation f or '.$glob al_contact ->describe ().' .</p> '; | |
| 1492 | $succe ss = true; | |
| 1493 | foreac h ($shared _users as $shared_us er) { | |
| 1494 | if(empty ($shared_u ser)) cont inue; //so me of the fields jus t have a c omma in it for some reason | |
| 1495 | $user = User::find _one(array ('user_nam e' => $sha red_user)) ; | |
| 1496 | if (User ::is_an_en tity($user )){ | |
| 1497 | if($global _contact-> add_to_use r_contact_ list($user )){ | |
| 1498 | ec ho '<p>Suc cessfully added shar ed relatio nship with User: '.$ user->user _name.'</p >'; | |
| 1499 | }else{ | |
| 1500 | $s uccess = f alse; | |
| 1501 | ec ho '<p>Err or occured while try ing to upd ate Global Contact: '. $global _contact-> contact_id . ' that i s shared w ith User: ' . $user- >user_name . ' </p>'; | |
| 1502 | } | |
| 1503 | } | |
| 1504 | } | |
| 1505 | if($su ccess){ | |
| 1506 | $global_ contact->s haring = n ull; | |
| 1507 | $global_ contact->s ave(); | |
| 1508 | } | |
| 1509 | } | |
| 1510 | ||
| 1511 | echo '<p>Done! '.Global_ contact::c ount('shar ing IS NOT NULL').' contacts i n the data base still have a va lue for ad min_contac t_list.sha ring and s hould be c orrected m anually.</ p>'; | |
| 1512 | } | |
| 1513 | ||
| 1514 | pu blic funct ion add_ne w_LDAP_rol e(){ | |
| 1515 | ec ho '<span style="col or:green"> OK</span>' ; | |
| 1516 | ec ho '...Upd ating LDAP ...'; | |
| 1517 | $l dap_conn = $this->pr epare_ldap _conn(); | |
| 1518 | $l dap_bind = @ldap_bin d($ldap_co nn, LDAP_A NON_ADMIN_ USERNAME, LDAP_ANON_ ADMIN_PASS WORD); | |
| 1519 | if ($ldap_bin d) | |
| 1520 | { | |
| 1521 | $dn = 'o u=accountg roupmainte nance,ou=r oles,'.LDA P_BASE_RDN ; | |
| 1522 | ||
| 1523 | $info['o bjectClass '] = "grou pOfNames"; | |
| 1524 | $info['o u'] = "acc ountgroupm aintenance "; | |
| 1525 | $info["c n"] = "Acc ount Group Maintenan ce"; | |
| 1526 | $info['m ember'] = LDAP_ANON_ ADMIN_USER NAME; | |
| 1527 | ||
| 1528 | ||
| 1529 | if(!$thi s->ldap_en try_exists ($ldap_con n, $dn)) | |
| 1530 | { | |
| 1531 | $suc cess = lda p_add($lda p_conn, $d n, $info); | |
| 1532 | if($ success) | |
| 1533 | { | |
| 1534 | echo '<br> <span styl e="color:g reen">OK</ span>'; | |
| 1535 | } | |
| 1536 | else | |
| 1537 | { | |
| 1538 | echo '<spa n style="c olor:red"> Error: Una ble to mod ify LDAP a ccount</sp an>'; | |
| 1539 | } | |
| 1540 | } | |
| 1541 | else | |
| 1542 | { | |
| 1543 | echo '<span st yle="color :red">Erro r: LDAP ro le '. $dn. ' does exi st!</span> '; | |
| 1544 | } | |
| 1545 | } | |
| 1546 | el se | |
| 1547 | { | |
| 1548 | echo '<s pan style= "color:red ">Error: U nable to b ind to LDA P</span>'; | |
| 1549 | } | |
| 1550 | } | |
| 1551 | ||
| 1552 | public function update_lda p_descript ions(){ | |
| 1553 | ec ho '<span style="col or:green"> OK</span>' ; | |
| 1554 | ec ho '...Upd ating LDAP ...'; | |
| 1555 | $l dap_conn = $this->pr epare_ldap _conn(); | |
| 1556 | $l dap_bind = @ldap_bin d($ldap_co nn, LDAP_A NON_ADMIN_ USERNAME, LDAP_ANON_ ADMIN_PASS WORD); | |
| 1557 | if ($ldap_bin d) | |
| 1558 | { | |
| 1559 | $dn = 'o u=accountg roupmainte nance,ou=r oles,'.LDA P_BASE_RDN ; | |
| 1560 | ||
| 1561 | $info['d escription '] = "Acco unt Group Maintenanc e Descript ion Placeh older"; | |
| 1562 | ||
| 1563 | ||
| 1564 | if($this ->ldap_ent ry_exists( $ldap_conn , $dn)) | |
| 1565 | { | |
| 1566 | $suc cess = lda p_modify($ ldap_conn, $dn, $inf o); | |
| 1567 | if($ success) | |
| 1568 | { | |
| 1569 | echo '<br> <span styl e="color:g reen">' . $dn . '</s pan>'; | |
| 1570 | echo '<br> <span styl e="color:g reen">OK</ span>'; | |
| 1571 | } | |
| 1572 | else | |
| 1573 | { | |
| 1574 | echo '<spa n style="c olor:red"> Error: Una ble to mod ify LDAP a ccount</sp an>'; | |
| 1575 | } | |
| 1576 | } | |
| 1577 | else | |
| 1578 | { | |
| 1579 | echo '<span st yle="color :red">Erro r: LDAP ro le does ex ist!</span >'; | |
| 1580 | } | |
| 1581 | ////// | |
| 1582 | ||
| 1583 | $dn = 'o u=facility leader, ou =roles,'.L DAP_BASE_R DN; | |
| 1584 | ||
| 1585 | $info = []; | |
| 1586 | ||
| 1587 | $info['d escription '] = "1) F acility le aders are NVCC and V A Staff wh o are resp onsible fo r managing the facil ity they a re assigne d. Users w ith the fa cility lea der role a re leaders to the fa cility in their prof ile. The f acility le ader will have the d efault use r role as well as ac cess to so me certain features of the Web mail. 2) A facility leader has all of th e permissi ons as a n on-adminis trative us er."; | |
| 1588 | ||
| 1589 | ||
| 1590 | if($this ->ldap_ent ry_exists( $ldap_conn , $dn)) | |
| 1591 | { | |
| 1592 | $suc cess = lda p_modify($ ldap_conn, $dn, $inf o); | |
| 1593 | if($ success) | |
| 1594 | { | |
| 1595 | echo '<br> <span styl e="color:g reen">' . $dn . '</s pan>'; | |
| 1596 | echo '<br> <span styl e="color:g reen">OK</ span>'; | |
| 1597 | } | |
| 1598 | else | |
| 1599 | { | |
| 1600 | echo '<spa n style="c olor:red"> Error: Una ble to mod ify LDAP a ccount</sp an>'; | |
| 1601 | } | |
| 1602 | } | |
| 1603 | else | |
| 1604 | { | |
| 1605 | echo '<span st yle="color :red">Erro r: LDAP ro le does ex ist!</span >'; | |
| 1606 | } | |
| 1607 | ||
| 1608 | ////// | |
| 1609 | ||
| 1610 | $dn = 'o u=grouplea der, ou=ro les,'.LDAP _BASE_RDN; | |
| 1611 | ||
| 1612 | $info = []; | |
| 1613 | ||
| 1614 | $info['d escription '] = "Grou p leaders are NVCC a nd VA Staf f who are responsibl e for mana ging group s to which they are assigned. Users who have been granted th e group le ader role are group leaders to any group they are a member o f. The gro up leader has the de fault user role as w ell as acc ess to som e certain features o f the Webm ail."; | |
| 1615 | ||
| 1616 | ||
| 1617 | if($this ->ldap_ent ry_exists( $ldap_conn , $dn)) | |
| 1618 | { | |
| 1619 | $suc cess = lda p_modify($ ldap_conn, $dn, $inf o); | |
| 1620 | if($ success) | |
| 1621 | { | |
| 1622 | echo '<br> <span styl e="color:g reen">' . $dn . '</s pan>'; | |
| 1623 | echo '<br> <span styl e="color:g reen">OK</ span>'; | |
| 1624 | } | |
| 1625 | else | |
| 1626 | { | |
| 1627 | echo '<spa n style="c olor:red"> Error: Una ble to mod ify LDAP a ccount</sp an>'; | |
| 1628 | } | |
| 1629 | } | |
| 1630 | else | |
| 1631 | { | |
| 1632 | echo '<span st yle="color :red">Erro r: LDAP ro le does ex ist!</span >'; | |
| 1633 | } | |
| 1634 | ||
| 1635 | ////// | |
| 1636 | ||
| 1637 | $dn = LD AP_API_ADM IN_GROUP; | |
| 1638 | ||
| 1639 | $info = []; | |
| 1640 | ||
| 1641 | $info['d escription '] = "API Admins Des cription P laceholder "; | |
| 1642 | ||
| 1643 | ||
| 1644 | if($this ->ldap_ent ry_exists( $ldap_conn , $dn)) | |
| 1645 | { | |
| 1646 | $suc cess = lda p_modify($ ldap_conn, $dn, $inf o); | |
| 1647 | if($ success) | |
| 1648 | { | |
| 1649 | echo '<br> <span styl e="color:g reen">' . $dn . '</s pan>'; | |
| 1650 | echo '<br> <span styl e="color:g reen">OK</ span>'; | |
| 1651 | } | |
| 1652 | else | |
| 1653 | { | |
| 1654 | echo '<spa n style="c olor:red"> Error: Una ble to mod ify LDAP a ccount</sp an>'; | |
| 1655 | } | |
| 1656 | } | |
| 1657 | else | |
| 1658 | { | |
| 1659 | echo '<span st yle="color :red">Erro r: LDAP ro le does ex ist!</span >'; | |
| 1660 | } | |
| 1661 | ////// | |
| 1662 | ||
| 1663 | $dn = 'o u=admins, ou=VLER Di rect API,' .LDAP_APPL ICATION_GR OUP; | |
| 1664 | ||
| 1665 | $info = []; | |
| 1666 | ||
| 1667 | $info['d escription '] = "The Direct Sec ure Messag ing team w ill be the administr ators and supervisor s with pri vileges us ing DaaS w eb service s. An admi nistrative user can make any e xisting us er a group leader or facility leader"; | |
| 1668 | ||
| 1669 | ||
| 1670 | if($this ->ldap_ent ry_exists( $ldap_conn , $dn)) | |
| 1671 | { | |
| 1672 | $suc cess = lda p_modify($ ldap_conn, $dn, $inf o); | |
| 1673 | if($ success) | |
| 1674 | { | |
| 1675 | echo '<br> <span styl e="color:g reen">' . $dn . '</s pan>'; | |
| 1676 | echo '<br> <span styl e="color:g reen">OK</ span>'; | |
| 1677 | } | |
| 1678 | else | |
| 1679 | { | |
| 1680 | echo '<spa n style="c olor:red"> Error: Una ble to mod ify LDAP a ccount</sp an>'; | |
| 1681 | } | |
| 1682 | } | |
| 1683 | else | |
| 1684 | { | |
| 1685 | echo '<span st yle="color :red">Erro r: LDAP ro le does ex ist!</span >'; | |
| 1686 | } | |
| 1687 | ||
| 1688 | ////// | |
| 1689 | ||
| 1690 | $dn = 'o u=users, o u=VLER Dir ect API,'. LDAP_APPLI CATION_GRO UP; | |
| 1691 | ||
| 1692 | $info = []; | |
| 1693 | ||
| 1694 | $info['d escription '] = "A Di rect Secur e Messagin g API Admi nistration Panel use r with PIV access."; | |
| 1695 | ||
| 1696 | ||
| 1697 | if($this ->ldap_ent ry_exists( $ldap_conn , $dn)) | |
| 1698 | { | |
| 1699 | $suc cess = lda p_modify($ ldap_conn, $dn, $inf o); | |
| 1700 | if($ success) | |
| 1701 | { | |
| 1702 | echo '<br> <span styl e="color:g reen">' . $dn . '</s pan>'; | |
| 1703 | echo '<br> <span styl e="color:g reen">OK</ span>'; | |
| 1704 | } | |
| 1705 | else | |
| 1706 | { | |
| 1707 | echo '<spa n style="c olor:red"> Error: Una ble to mod ify LDAP a ccount</sp an>'; | |
| 1708 | } | |
| 1709 | } | |
| 1710 | else | |
| 1711 | { | |
| 1712 | echo '<span st yle="color :red">Erro r: LDAP ro le does ex ist!</span >'; | |
| 1713 | } | |
| 1714 | ||
| 1715 | ////// | |
| 1716 | ||
| 1717 | $dn = 'o u=admins, ou=VLER Di rect Webma il,'.LDAP_ APPLICATIO N_GROUP; | |
| 1718 | ||
| 1719 | $info = []; | |
| 1720 | ||
| 1721 | $info['d escription '] = "Dire ct Secure Messaging team who w ill be the administr ators of t he system and superv isors with the abili ty to elev ate the pr ivileges o f other us ers if nee ded. Admin istrative users have the permi ssions of all the pr evious use rs. Admini strative u sers can a ssign the Group Lead er and Fac ility Lead er roles t o another user."; | |
| 1722 | ||
| 1723 | ||
| 1724 | if($this ->ldap_ent ry_exists( $ldap_conn , $dn)) | |
| 1725 | { | |
| 1726 | $suc cess = lda p_modify($ ldap_conn, $dn, $inf o); | |
| 1727 | if($ success) | |
| 1728 | { | |
| 1729 | echo '<br> <span styl e="color:g reen">' . $dn . '</s pan>'; | |
| 1730 | echo '<br> <span styl e="color:g reen">OK</ span>'; | |
| 1731 | } | |
| 1732 | else | |
| 1733 | { | |
| 1734 | echo '<spa n style="c olor:red"> Error: Una ble to mod ify LDAP a ccount</sp an>'; | |
| 1735 | } | |
| 1736 | } | |
| 1737 | else | |
| 1738 | { | |
| 1739 | echo '<span st yle="color :red">Erro r: LDAP ro le does ex ist!</span >'; | |
| 1740 | } | |
| 1741 | ||
| 1742 | ////// | |
| 1743 | ||
| 1744 | $dn = 'o u=users, o u=VLER Dir ect Webmai l,'.LDAP_A PPLICATION _GROUP; | |
| 1745 | ||
| 1746 | $info = []; | |
| 1747 | ||
| 1748 | $info['d escription '] = "The non-admini strative u sers are N VCC and VA Staff who are respo nsible for providing effective managemen t of healt h care and benefits services t o the Vete rans and e ligible fa mily membe rs in an e ffective a nd compass ionate man ner and ha ve the def ault user role."; | |
| 1749 | ||
| 1750 | ||
| 1751 | if($this ->ldap_ent ry_exists( $ldap_conn , $dn)) | |
| 1752 | { | |
| 1753 | $suc cess = lda p_modify($ ldap_conn, $dn, $inf o); | |
| 1754 | if($ success) | |
| 1755 | { | |
| 1756 | echo '<br> <span styl e="color:g reen">' . $dn . '</s pan>'; | |
| 1757 | echo '<br> <span styl e="color:g reen">OK</ span>'; | |
| 1758 | } | |
| 1759 | else | |
| 1760 | { | |
| 1761 | echo '<spa n style="c olor:red"> Error: Una ble to mod ify LDAP a ccount</sp an>'; | |
| 1762 | } | |
| 1763 | } | |
| 1764 | else | |
| 1765 | { | |
| 1766 | echo '<span st yle="color :red">Erro r: LDAP ro le does ex ist!</span >'; | |
| 1767 | } | |
| 1768 | } | |
| 1769 | el se | |
| 1770 | { | |
| 1771 | echo '<s pan style= "color:red ">Error: U nable to b ind to LDA P</span>'; | |
| 1772 | } | |
| 1773 | } | |
| 1774 | ||
| 1775 | ||
| 1776 | ||
| 1777 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.