forked from HelloZeroNet/ZeroNet
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rev989, Save users file on newsfeed follow, Local mode in Multiuser p…
…lugin to disable restrication and save users data to disk
- Loading branch information
1 parent
0897154
commit ed0e858
Showing
4 changed files
with
75 additions
and
34 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -0,0 +1,35 @@ | ||
from Config import config | ||
from Plugin import PluginManager | ||
|
||
allow_reload = False | ||
|
||
@PluginManager.registerTo("UserManager") | ||
class UserManagerPlugin(object): | ||
def load(self): | ||
if not config.multiuser_local: | ||
# In multiuser mode do not load the users | ||
if not self.users: | ||
self.users = {} | ||
return self.users | ||
else: | ||
return super(UserManagerPlugin, self).load() | ||
|
||
# Find user by master address | ||
# Return: User or None | ||
def get(self, master_address=None): | ||
users = self.list() | ||
if master_address in users: | ||
user = users[master_address] | ||
else: | ||
user = None | ||
return user | ||
|
||
|
||
@PluginManager.registerTo("User") | ||
class UserPlugin(object): | ||
# In multiuser mode users data only exits in memory, dont write to data/user.json | ||
def save(self): | ||
if not config.multiuser_local: | ||
return False | ||
else: | ||
return super(UserPlugin, self).save() |
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