doctor可以属于subjectCat (试图获得访问权限的用户)或resourceCat (对象试图访问的医学检查的推荐医生)。
在我看来,为了支持这两种情况,我需要为每个类别分别定义doctor:
namespace subject {
namespace doctor {
attribute id {
category = subjectCat
id = "id"
type = string
}
attribute lastname {
category = subjectCat
id = "lastname"
type = string
}
//and 20 more attributes...
}
}
namespace resource {
namespace doctor {
attribute id {
category = resourceCat //this line is the only difference
id = "id"
type = string
}
attribute lastname {
category = resourceCat //this line is the only difference
id = "lastname"
type = string
}
//and 20 more attributes...
}
}这很麻烦,而且有很多冗余。有什么我能避免的吗?
发布于 2018-05-24 16:48:12
你是正确的。您将重新定义属性。在某种程度上,您正在使用来自您的信息模型(例如,医生)的相同对象,但在一种情况下,该对象(医生)充当一个主体。在另一种情况下,它充当您正在保护的对象。
是的,这意味着您必须在多个类别中定义属性本身。您仍然可以利用命名空间结构,只要名称空间和名称的组合仍然是唯一的。
您可以执行acme.user.staff.doctor和属性name。然后您可以执行acme.object.doctor和属性name。
请注意,Eclipse也将允许您完成自动完成操作:

https://stackoverflow.com/questions/50504810
复制相似问题