nsarchive 1.1.7__py3-none-any.whl → 1.2.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- nsarchive/__init__.py +20 -5
- nsarchive/cls/entities.py +11 -6
- {nsarchive-1.1.7.dist-info → nsarchive-1.2.0.dist-info}/METADATA +1 -1
- {nsarchive-1.1.7.dist-info → nsarchive-1.2.0.dist-info}/RECORD +6 -6
- {nsarchive-1.1.7.dist-info → nsarchive-1.2.0.dist-info}/LICENSE +0 -0
- {nsarchive-1.1.7.dist-info → nsarchive-1.2.0.dist-info}/WHEEL +0 -0
nsarchive/__init__.py
CHANGED
@@ -56,7 +56,7 @@ class EntityInstance:
|
|
56
56
|
|
57
57
|
entity.xp = _data['xp']
|
58
58
|
entity.boosts = _data['boosts']
|
59
|
-
|
59
|
+
|
60
60
|
if _votes is None:
|
61
61
|
entity.votes = []
|
62
62
|
else:
|
@@ -65,14 +65,28 @@ class EntityInstance:
|
|
65
65
|
entity = Organization(id)
|
66
66
|
|
67
67
|
entity.owner = self.get_entity(NSID(_data['owner_id']))
|
68
|
-
|
68
|
+
|
69
69
|
for _member in _data['members']:
|
70
70
|
member = GroupMember(_member['id'])
|
71
|
-
member.
|
71
|
+
member.group_permissions.__dict__ = _member['permissions']
|
72
|
+
|
73
|
+
_member_profile = self.get_entity(member.id)
|
74
|
+
|
75
|
+
member.set_name(_member_profile.name)
|
76
|
+
member.legalPosition = _member_profile.legalPosition
|
77
|
+
member.registerDate = _member_profile.registerDate
|
78
|
+
|
79
|
+
member.xp = _member_profile.xp
|
80
|
+
member.boosts = _member_profile.boosts
|
81
|
+
|
82
|
+
member.permissions = _member_profile.permissions
|
83
|
+
member.votes = _member_profile.votes
|
84
|
+
|
85
|
+
entity.append(member)
|
72
86
|
|
73
87
|
try:
|
74
88
|
entity.avatar = self.avatars.get(id).read()
|
75
|
-
except:
|
89
|
+
except:
|
76
90
|
entity.avatar = None
|
77
91
|
|
78
92
|
entity.certifications = _data['certifications']
|
@@ -126,7 +140,8 @@ class EntityInstance:
|
|
126
140
|
for vote in entity.votes:
|
127
141
|
_votes.append(NSID(vote))
|
128
142
|
|
129
|
-
|
143
|
+
self.electors.put({ "votes": _votes }, entity.id, expire_in = 112 * 84600) # Données supprimées après 16 semaines d'inactivité
|
144
|
+
|
130
145
|
_base.put(_data, entity.id, expire_in = 3 * 31536000) # Pareil après 3 ans
|
131
146
|
|
132
147
|
def delete_entity(self, entity: Entity) -> None:
|
nsarchive/cls/entities.py
CHANGED
@@ -99,11 +99,12 @@ class MemberPermissions:
|
|
99
99
|
for perm in permissions.values():
|
100
100
|
self.__setattr__(*perm)
|
101
101
|
|
102
|
-
class GroupMember():
|
102
|
+
class GroupMember(User):
|
103
103
|
def __init__(self, id: str | NSID) -> None:
|
104
|
-
|
105
|
-
|
106
|
-
self.
|
104
|
+
super().__init__(id)
|
105
|
+
|
106
|
+
self.group_permissions: MemberPermissions = MemberPermissions()
|
107
|
+
self.group_position: str = 'membre'
|
107
108
|
|
108
109
|
class Official:
|
109
110
|
def __init__(self, id: str | NSID) -> None:
|
@@ -137,11 +138,15 @@ class Organization(Entity):
|
|
137
138
|
self.certifications[certif] = round(time.time())
|
138
139
|
|
139
140
|
def add_member(self, member: GroupMember) -> None:
|
141
|
+
if not isinstance(member, GroupMember):
|
142
|
+
raise TypeError("Le membre doit être de type GroupMember")
|
143
|
+
|
140
144
|
self.members.append(member)
|
141
145
|
|
142
146
|
def remove_member(self, member: GroupMember) -> None:
|
143
|
-
|
144
|
-
|
147
|
+
for _member in self.members:
|
148
|
+
if _member.id == member.id:
|
149
|
+
self.members.remove(_member)
|
145
150
|
|
146
151
|
def set_owner(self, member: User) -> None:
|
147
152
|
self.owner = member
|
@@ -1,13 +1,13 @@
|
|
1
|
-
nsarchive/__init__.py,sha256=
|
1
|
+
nsarchive/__init__.py,sha256=WaRNIlNiko1r3IuJtGmVKcWWKsW0CeqhIdnoHkIU474,25209
|
2
2
|
nsarchive/assets/default_avatar.png,sha256=n-4vG_WPke8LvbY3ZU6oA-H-OtRoIu7woKnRq9DCIlI,51764
|
3
3
|
nsarchive/cls/archives.py,sha256=Nmt3C0Zq9oGQdCXSzm_wo70VbNq89SY3dx9KKqEpoCg,2182
|
4
4
|
nsarchive/cls/base.py,sha256=z7NTvrtbeaUF1T_o-J7PL2N8axkmJek9EoKcQ8fTF9I,715
|
5
5
|
nsarchive/cls/economy.py,sha256=RjFu3VzNunazslbd4Ia5p1Jr-jJP5CvIcbVOzkDTwTU,549
|
6
|
-
nsarchive/cls/entities.py,sha256=
|
6
|
+
nsarchive/cls/entities.py,sha256=LcL0Ky19lqYQdnYqtF_84-CdlVS1sie05l8vV2yJLyw,6010
|
7
7
|
nsarchive/cls/exceptions.py,sha256=QN6Qn7cxTkGoC4lO50hBAq4gZCgo7scQvCkb-xKl6Xs,692
|
8
8
|
nsarchive/cls/republic.py,sha256=6eut6OsFoOm9TVhA41fM3NlMEA3Uhg9TCuXgl46vFko,1985
|
9
9
|
nsarchive/utils/assets.py,sha256=hd0STSpa0yT-OJlUyI_wCYXJqcBiUMQds2pZTXNNg9c,382
|
10
|
-
nsarchive-1.
|
11
|
-
nsarchive-1.
|
12
|
-
nsarchive-1.
|
13
|
-
nsarchive-1.
|
10
|
+
nsarchive-1.2.0.dist-info/LICENSE,sha256=aFLFZg6LEJFpTlNQ8su3__jw4GfV-xWBmC1cePkKZVw,35802
|
11
|
+
nsarchive-1.2.0.dist-info/METADATA,sha256=UYjUtZxdeV0JBDH6wFFSUm8IhiXgPopShAoPDQKP_qI,5629
|
12
|
+
nsarchive-1.2.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
13
|
+
nsarchive-1.2.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|