6
6
*/
7
7
class ImportController extends AppController
8
8
{
9
-
10
- public $ _models =array ('Item ' ,'Folder ' ,'ItemRevision ' ,'Assetstore ' ,'Folderpolicyuser ' ,'Itempolicyuser ' ,'ItemKeyword ' );
9
+ public $ _models =array ('Item ' ,'Folder ' ,'ItemRevision ' ,'Assetstore ' ,'Folderpolicyuser ' ,'Itempolicyuser ' ,'ItemKeyword ' ,'Itempolicygroup ' ,'Group ' ,'Folderpolicygroup ' );
11
10
public $ _daos =array ('Item ' ,'Folder ' ,'ItemRevision ' ,'Bitstream ' ,'Assetstore ' ,'ItemKeyword ' );
12
11
public $ _components =array ('Upload ' ,'Utility ' );
13
12
public $ _forms =array ('Import ' ,'Assetstore ' );
@@ -115,8 +114,11 @@ private function _recursiveParseDirectory($path,$currentdir)
115
114
$ child = new FolderDao ;
116
115
$ child ->setName ($ fileInfo ->getFilename ());
117
116
$ child ->setParentId ($ currentdir ->getFolderId ());
117
+ $ child ->setDate (date ('c ' ));
118
118
$ this ->Folder ->save ($ child );
119
- $ this ->Folderpolicyuser ->createPolicy ($ this ->userSession ->Dao ,$ child ,MIDAS_POLICY_ADMIN );
119
+ $ this ->Folderpolicyuser ->createPolicy ($ this ->userSession ->Dao ,$ child ,MIDAS_POLICY_ADMIN );
120
+ $ anonymousGroup =$ this ->Group ->load (MIDAS_GROUP_ANONYMOUS_KEY );
121
+ $ this ->Folderpolicygroup ->createPolicy ($ anonymousGroup ,$ child ,MIDAS_POLICY_READ );
120
122
}
121
123
$ this ->_recursiveParseDirectory ($ fileInfo ->getPathName (),$ child );
122
124
}
@@ -140,7 +142,9 @@ private function _recursiveParseDirectory($path,$currentdir)
140
142
$ this ->Item ->addKeyword ($ item ,$ keyword );
141
143
142
144
// Set the policy of the item
143
- $ this ->Itempolicyuser ->createPolicy ($ this ->userSession ->Dao ,$ item ,MIDAS_POLICY_ADMIN );
145
+ $ this ->Itempolicyuser ->createPolicy ($ this ->userSession ->Dao ,$ item ,MIDAS_POLICY_ADMIN );
146
+ $ anonymousGroup =$ this ->Group ->load (MIDAS_GROUP_ANONYMOUS_KEY );
147
+ $ this ->Itempolicygroup ->createPolicy ($ anonymousGroup ,$ item ,MIDAS_POLICY_READ );
144
148
145
149
// Add the item to the current directory
146
150
$ this ->Folder ->addItem ($ currentdir ,$ item );
0 commit comments