Assuming, each permission is power of two, match the bitwise operators to their typical use cases in managing permissions:
User roles
Power of bits
Report a typo
Fill in the gaps with the relevant elements
class Role(db.Model):
#...
def add_permission(self,permission):
if not self.has_permission(permission):
def remove_permission(self, permission):
if self.has_permission(permission):
def reset_permissions(self):
def has_permission(self, permission):
return ___
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.
Create a free account to access the full topic
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.