-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- File-module cleaned up (uses old current user access, etc.) - Index-module cleaned up (backup-function is obsolete) - User-module code clean-up - renders dummy removes xml - Updated dependencies and project.json
- Loading branch information
Showing
7 changed files
with
170 additions
and
254 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,17 @@ | ||
import datetime | ||
from typing import Dict, List | ||
from viur.core import i18n, db, current | ||
from viur.core.modules.file import File | ||
|
||
from viur.core import db, utils | ||
from viur.core.modules.file import File as _File | ||
|
||
class File(File): | ||
|
||
class File(_File): | ||
def getAvailableRootNodes(self, *args, **kwargs): | ||
# Any user who is logged in can see the root-node. | ||
if current.user.get(): | ||
repository = self.ensureOwnModuleRootNode() | ||
|
||
def getAvailableRootNodes(self, *args, **kwargs) -> List[Dict]: | ||
if utils.getCurrentUser(): | ||
repo: db.Entity = self.ensureOwnModuleRootNode() | ||
|
||
res = [ | ||
{ | ||
"name": "Files", | ||
"key": repo.key | ||
} | ||
] | ||
return res | ||
return [{ | ||
"name": i18n.translate("Files"), | ||
"key": repository.key | ||
}] | ||
|
||
return [] | ||
|
||
def ensureOwnModuleRootNode(self) -> db.Entity: | ||
""" | ||
Ensures, that general root-node for the current module exists. | ||
If no root-node exists yet, it will be created. | ||
:returns: The entity of the root-node. | ||
""" | ||
key = "rep_module_repo" | ||
kindName = self.viewSkel("node").kindName | ||
|
||
return db.GetOrInsert( | ||
db.Key(kindName, key), | ||
creationdate=datetime.datetime.now(), | ||
rootNode=1 | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
from viur.core.render import admin, html, json, vi, xml | ||
from viur.core.render import admin, html, json, vi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.