コード例 #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="user"></param>
        /// <param name="view"></param>
        /// <returns></returns>
        public static bool Permit(this IAcSession user, UiViewState view)
        {
            var securityService = user.AcDomain.RetrieveRequiredService <ISecurityService>();

            if (view == null)
            {
                throw new ArgumentNullException("view");
            }
            if (view == UiViewState.Empty)
            {
                return(true);
            }
            FunctionState function;

            if (!user.AcDomain.FunctionSet.TryGetFunction(view.Id, out function))
            {
                return(true);
            }
            return(securityService.Permit(user, function, null));
        }
コード例 #2
0
        public static bool Permit <TEntity, TInput>(this IAcSession user, UiViewState view, IManagedObject currentEntity)
            where TEntity : IManagedPropertyValues
            where TInput : IManagedPropertyValues
        {
            var securityService = user.AcDomain.RetrieveRequiredService <ISecurityService>();

            if (view == null)
            {
                throw new ArgumentNullException("view");
            }
            if (view == UiViewState.Empty)
            {
                return(true);
            }
            FunctionState function;

            if (!user.AcDomain.FunctionSet.TryGetFunction(view.Id, out function))
            {
                return(true);
            }
            return(securityService.Permit(user, function, currentEntity));
        }