Example #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);
            }
        }
Example #2
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);
        }