@@ -14,12 +14,12 @@ public function install()
14
14
15
15
// create acl table
16
16
$ fields = array (
17
- 'key ' => array (
18
- 'type ' => 'VARCHAR ' ,
19
- 'constraint ' => '255 '
17
+ 'key ' => array (
18
+ 'type ' => 'VARCHAR ' ,
19
+ 'constraint ' => '255 '
20
20
),
21
- 'value ' => array (
22
- 'type ' => 'TEXT '
21
+ 'value ' => array (
22
+ 'type ' => 'TEXT '
23
23
)
24
24
);
25
25
$ this ->dbforge ->drop_table ('acl ' );
@@ -29,21 +29,21 @@ public function install()
29
29
30
30
// create users table
31
31
$ fields = array (
32
- 'id ' => array (
33
- 'type ' => 'INT ' ,
34
- 'constraint ' => 11 ,
35
- 'null ' => false ,
36
- 'auto_increment ' => true
32
+ 'id ' => array (
33
+ 'type ' => 'INT ' ,
34
+ 'constraint ' => 11 ,
35
+ 'null ' => false ,
36
+ 'auto_increment ' => true
37
37
),
38
- 'email ' => array (
39
- 'type ' => 'VARCHAR ' ,
40
- 'constraint ' => '255 ' ,
41
- 'null ' => false
38
+ 'email ' => array (
39
+ 'type ' => 'VARCHAR ' ,
40
+ 'constraint ' => '255 ' ,
41
+ 'null ' => false
42
42
),
43
- 'password ' => array (
44
- 'type ' => 'VARCHAR ' ,
45
- 'constraint ' => '255 ' ,
46
- 'null ' => false
43
+ 'password ' => array (
44
+ 'type ' => 'VARCHAR ' ,
45
+ 'constraint ' => '255 ' ,
46
+ 'null ' => false
47
47
)
48
48
);
49
49
$ this ->dbforge ->drop_table ('users ' );
@@ -52,27 +52,27 @@ public function install()
52
52
$ this ->dbforge ->create_table ('users ' );
53
53
54
54
// default resources to protect
55
- $ acl = new ACL ();
55
+ $ acl = new ACL ();
56
56
$ acl ->addResource ('administrator ' );
57
57
$ acl ->addResource ('user ' );
58
58
$ acl ->addResource ('role ' );
59
59
$ acl ->addResource ('resource ' );
60
60
61
61
// create administrator role and grant all access
62
62
$ acl ->addRole ('administrator ' );
63
- $ acl ->addPermissions ('administrator ' , 'administrator ' , 'read ' );
64
- $ acl ->addPermissions ('administrator ' , 'user ' , ['create ' , 'read ' , 'update ' , 'delete ' ]);
65
- $ acl ->addPermissions ('administrator ' , 'role ' , ['create ' , 'read ' , 'update ' , 'delete ' ]);
66
- $ acl ->addPermissions ('administrator ' , 'resource ' , ['create ' , 'read ' , 'update ' , 'delete ' ]);
63
+ $ acl ->addPermissions ('administrator ' , 'administrator ' , 'read ' );
64
+ $ acl ->addPermissions ('administrator ' , 'user ' , ['create ' , 'read ' , 'update ' , 'delete ' ]);
65
+ $ acl ->addPermissions ('administrator ' , 'role ' , ['create ' , 'read ' , 'update ' , 'delete ' ]);
66
+ $ acl ->addPermissions ('administrator ' , 'resource ' , ['create ' , 'read ' , 'update ' , 'delete ' ]);
67
67
68
- // custom resources
68
+ // custom resources
69
69
70
- // ...
71
- // ... add your custom resources to protect here
72
- // ...
70
+ // ...
71
+ // ... add your custom resources to protect here
72
+ // ...
73
73
74
74
if (!defined ('PHPUNIT_TEST ' ))
75
- echo "installed \r\n" ;
75
+ echo "installed \r\n" ;
76
76
}
77
77
78
78
public function add ($ type , $ email , $ password )
@@ -84,16 +84,16 @@ public function add($type, $email, $password)
84
84
$ this ->Users ->register ($ email , $ password );
85
85
86
86
if (!defined ('PHPUNIT_TEST ' ))
87
- echo "user added \r\n" ;
87
+ echo "user added \r\n" ;
88
88
}
89
89
else if ($ type == 'administrator ' )
90
90
{
91
91
$ id = $ this ->Users ->register ($ email , $ password );
92
- $ acl = new ACL ();
92
+ $ acl = new ACL ();
93
93
$ acl ->addUserRoles ($ id , 'administrator ' );
94
94
95
95
if (!defined ('PHPUNIT_TEST ' ))
96
- echo "administrator added \r\n" ;
96
+ echo "administrator added \r\n" ;
97
97
}
98
98
}
99
99
0 commit comments