Skip to content
Permalink
Browse files

Add has_property method to user class

  • Loading branch information...
ibot3 committed Aug 28, 2019
1 parent 1903ba8 commit c4d8c21b52378dd03cd0c7b4a6898c8d4cd9ac1f
Showing with 8 additions and 0 deletions.
  1. +1 −0 sipa/model/pycroft/schema.py
  2. +3 −0 sipa/model/pycroft/user.py
  3. +4 −0 sipa/model/user.py
@@ -17,6 +17,7 @@ class UserData:
room: str
mail: str
cache: bool
properties: List[str]
traffic_history: List[TrafficHistoryEntry]
interfaces: List[Interface]
finance_balance: Decimal
@@ -245,6 +245,9 @@ def payment_details(self) -> PaymentDetails:
),
)

def has_property(self, property):
return property in self.user_data.properties


def to_kib(v: int) -> int:
return (v // 1024) if v is not None else 0
@@ -280,6 +280,10 @@ def payment_details(self) -> PaymentDetails:
"""**[Abstract]** Payment details for the User."""
pass

def has_property(self, property):
"""Method to check if a user has a property"""
return False


class BaseUserDB(metaclass=ABCMeta):
"""An abstract base class defining an interface for a user's

0 comments on commit c4d8c21

Please sign in to comment.
You can’t perform that action at this time.