本文介绍了DDD用户安全策略的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个看起来像这样一个RentalProperty类:

I have a RentalProperty class which looks something like this:

class RentalProperty
{
    Money MonthlyRent;
    List<MaintainenceCall> MaintainenceCalls;
}

这是我的理解,采用DDD改变MonthlyRent,我会得到RentalProperty,改变MonthlyRent财产,并调用RentalPropertyRepository.Save()。相同的处理将被处理,以增加新的MaintainenceCall。

From my understanding, using DDD to change the MonthlyRent, I would get the RentalProperty, change the MonthlyRent property, and call RentalPropertyRepository.Save(). The same process would be handled to add a new MaintainenceCall.

我的问题是,例如,一个杂工应该能够增加一个MaintainenceCall,但不应该被允许改变MonthlyRent。我应该如何实现这个(以及其他类似的)安全策略?

The problem I have is that, for example, a Handyman should be able to add a MaintainenceCall, but should not be allowed to change the MonthlyRent. How should I implement this (as well as other similar) security policy?

推荐答案

AOP。 PostSharp 是真的光滑这样的东西。

AOP. PostSharp is really slick for stuff like this.

由于安全确实是一个跨部门的关注。

Because security is really a cross-cutting concern.

这篇关于DDD用户安全策略的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-12 19:15