Ejemplo n.º 1
0
        /// <summary>
        /// 判断本节点是否具有对给定的本体元素执行给定的类型的动作的权限
        /// </summary>
        /// <param name="element">本体元素码</param>
        /// <param name="actionCode">动作码</param>
        /// <returns>True表示有权限,False表示无权限</returns>
        public AllowType GetElementPermission(ElementDescriptor element, Verb actionCode)
        {
            if (element == null)
            {
                throw new ArgumentNullException("element");
            }
            if (actionCode == null)
            {
                throw new ArgumentNullException("actionCode");
            }
            if (element == element.Ontology.IdElement)
            {
                return(AllowType.ExplicitAllow);
            }
            var nodeElementActions = element.GetActions(this);

            if (!nodeElementActions.ContainsKey(actionCode))
            {
                return(AllowType.NotAllow);
            }
            if (nodeElementActions[actionCode].IsAllowed)
            {
                return(AllowType.ImplicitAllow);
            }
            else
            {
                return(AllowType.NotAllow);
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// 判断本节点是否关心给定的本体元素。
 /// <remarks>关心本体元素的前提是关心了元素所属的本体,否则必返回false表示不关心。</remarks>
 /// </summary>
 /// <param name="element">本体元素码</param>
 /// <returns>True表示关心,False表示不关心</returns>
 public bool IsCareforElement(ElementDescriptor element)
 {
     if (element == null)
     {
         throw new ArgumentNullException("element");
     }
     return(AcDomain.NodeHost.Nodes.IsCareforElement(this, element));
 }
Ejemplo n.º 3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="element"></param>
        /// <param name="actionCode"></param>
        /// <returns></returns>
        public AuditType GetElementAudit(ElementDescriptor element, Verb actionCode)
        {
            if (element == null)
            {
                throw new ArgumentNullException("element");
            }
            if (actionCode == null)
            {
                throw new ArgumentNullException("actionCode");
            }
            var nodeElementActions = element.GetActions(this);

            if (!nodeElementActions.ContainsKey(actionCode))
            {
                return(AuditType.NotAudit);
            }
            return(nodeElementActions[actionCode].IsAudit ? AuditType.ImplicitAudit : AuditType.NotAudit);
        }