def test_add_permission_with_any(self): """ User who is in adam, seele, nerv, children have add permission """ permission_logic = self.permission_logic_class(any_permission=True) add_permission_logic(Article, permission_logic) self._auto_test_permission('add') remove_permission_logic(Article, permission_logic)
def test_add_permission_with_any(self): """ User who is in adam, seele, nerv, children have add permission """ permission_logic = self.permission_logic_class( any_permission=True ) add_permission_logic(Article, permission_logic) self._auto_test_permission('add') remove_permission_logic(Article, permission_logic)
def test_delete_permission_with_others(self): """ adam以外の全てのユーザーは他人の持っているオブジェクトに削除権限を持たない """ permission_logic = self.permission_logic_class(any_permission=True) add_permission_logic(Article, permission_logic) kwargs = {'object_permission': True, 'author': self.user} self._test_permission('adam', 'delete', **kwargs) self._test_permission('seele', 'delete', neg=True, **kwargs) self._test_permission('nerv', 'delete', neg=True, **kwargs) self._test_permission('children', 'delete', neg=True, **kwargs) self._test_permission('wille', 'delete', neg=True, **kwargs) remove_permission_logic(Article, permission_logic)
def test_delete_permission_with_any(self): """ Adam, Seele, Nerv, Childrenはいずれかのオブジェクトの削除権限を持つ Willeは削除権限を持たない """ permission_logic = self.permission_logic_class(any_permission=True) add_permission_logic(Article, permission_logic) self._test_permission('adam', 'delete') self._test_permission('seele', 'delete') self._test_permission('nerv', 'delete') self._test_permission('children', 'delete') self._test_permission('wille', 'delete', neg=True) remove_permission_logic(Article, permission_logic)
def test_delete_permission_with_own(self): """ Adam, Seele, Nerv, Childrenは自分の持っているオブジェクトに削除権限を持つ Willeは削除権限を持たない """ permission_logic = self.permission_logic_class( any_permission=True ) add_permission_logic(Article, permission_logic) self._test_permission('adam', 'delete', object_permission=True) self._test_permission('seele', 'delete', object_permission=True) self._test_permission('nerv', 'delete', object_permission=True) self._test_permission('children', 'delete', object_permission=True) self._test_permission('wille', 'delete', neg=True, object_permission=True) remove_permission_logic(Article, permission_logic)
def test_change_permission_with_any(self): """ Adam, Seele, Nerv, Childrenはいずれかのオブジェクトの変更権限を持つ Willeは変更権限を持たない """ permission_logic = self.permission_logic_class( any_permission=True ) add_permission_logic(Article, permission_logic) self._test_permission('adam', 'change') self._test_permission('seele', 'change') self._test_permission('nerv', 'change') self._test_permission('children', 'change') self._test_permission('wille', 'change', neg=True) remove_permission_logic(Article, permission_logic)
def test_change_permission_with_own(self): """ Adam, Seele, Nerv, Childrenは自分の持っているオブジェクトに変更権限を持つ Willeは変更権限を持たない """ permission_logic = self.permission_logic_class( any_permission=True ) add_permission_logic(Article, permission_logic) self._test_permission('adam', 'change', object_permission=True) self._test_permission('seele', 'change', object_permission=True) self._test_permission('nerv', 'change', object_permission=True) self._test_permission('children', 'change', object_permission=True) self._test_permission('wille', 'change', neg=True, object_permission=True) remove_permission_logic(Article, permission_logic)
def test_delete_permission_with_others(self): """ adam以外の全てのユーザーは他人の持っているオブジェクトに削除権限を持たない """ permission_logic = self.permission_logic_class( any_permission=True ) add_permission_logic(Article, permission_logic) kwargs = { 'object_permission': True, 'author': self.user } self._test_permission('adam', 'delete', **kwargs) self._test_permission('seele', 'delete', neg=True, **kwargs) self._test_permission('nerv', 'delete', neg=True, **kwargs) self._test_permission('children', 'delete', neg=True, **kwargs) self._test_permission('wille', 'delete', neg=True, **kwargs) remove_permission_logic(Article, permission_logic)