Esempio n. 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="ontology"></param>
        /// <param name="actionCode"></param>
        /// <returns></returns>
        public AuditType GetOntologyAudit(OntologyDescriptor ontology, Verb actionCode)
        {
            if (ontology == null)
            {
                throw new ArgumentNullException("ontology");
            }
            if (actionCode == null)
            {
                throw new ArgumentNullException("actionCode");
            }
            var nodeActions = this.Node.NodeActions;

            if (!nodeActions.ContainsKey(ontology) || !nodeActions[ontology].ContainsKey(actionCode))
            {
                return(AuditType.NotAudit);
            }

            return(nodeActions[ontology][actionCode].AuditType);
        }
Esempio n. 2
0
        /// <summary>
        /// 判断本节点是否具有对给定的本体执行给定的类型的动作的权限
        /// </summary>
        /// <param name="ontology">本体</param>
        /// <param name="actionCode">动作码</param>
        /// <returns>True表示有权限,False表示无权限</returns>
        public AllowType GetOntologyPermission(OntologyDescriptor ontology, Verb actionCode)
        {
            if (ontology == null)
            {
                throw new ArgumentNullException("ontology");
            }
            if (actionCode == null)
            {
                throw new ArgumentNullException("actionCode");
            }
            if (!ontology.Actions.ContainsKey(actionCode))
            {
                throw new GeneralException("非法的动作码");
            }
            var nodeActions = this.Node.NodeActions;

            if (!nodeActions.ContainsKey(ontology) || !nodeActions[ontology].ContainsKey(actionCode))
            {
                return(AllowType.NotAllow);
            }

            return(nodeActions[ontology][actionCode].AllowType);
        }