示例#1
0
        /// <summary>
        /// Execute
        /// </summary>
        /// <returns></returns>
        protected override bool Execute()
        {
            DTO.CcnUsername = SamAccountName;
            if (!IsUserAuthenticated())
            {
                return(true);
            }
            JSONRPC_Output response = new JSONRPC_Output();
            //The cache key is created to be unique to a given CcnUsername.
            MemCachedD_Value cache = MemCacheD.Get_BSO <dynamic>("PxStat.Security", "Account_API", "ReadCurrentAccesss", DTO.CcnUsername);

            if (cache.hasData)
            {
                Response.data = cache.data;
                return(true);
            }


            Account_BSO      bso    = new Account_BSO();
            ADO_readerOutput output = bso.ReadCurrentAccess(Ado, DTO.CcnUsername);

            if (!output.hasData)
            {
                Log.Instance.Debug("No Account data found");
                return(false);
            }
            Response.data = output.data;
            return(true);
        }
        /// <summary>
        /// Execute
        /// </summary>
        /// <returns></returns>
        protected override bool Execute()
        {
            if (IsUserAuthenticated())
            {
                if (AuthenticationType != authenticationType)
                {
                    return(false);
                }
            }


            DTO.CcnUsername = SamAccountName;

            Log.Instance.Debug("ReadCurrentAccess SamAccountName:" + DTO.CcnUsername);

            if (DTO.CcnUsername == null)
            {
                Response.data = null;
                return(true);
            }



            Account_BSO      bso    = new Account_BSO(Ado);
            ADO_readerOutput output = bso.ReadCurrentAccess(Ado, DTO.CcnUsername);

            if (!output.hasData)
            {
                Log.Instance.Debug("No Account data found");
                return(false);
            }

            Response.data = output.data[0];
            return(true);
        }
示例#3
0
        /// <summary>
        /// Execute
        /// </summary>
        /// <returns></returns>
        protected override bool Execute()
        {
            Account_BSO acBso = new Account_BSO();

            if (string.IsNullOrEmpty(DTO.CcnUsername))
            {
                Response.data = acBso.IsPowerUser(Ado, SamAccountName);
            }
            else
            {
                Response.data = acBso.IsPowerUser(Ado, DTO.CcnUsername);
            }


            return(Response.data != null);
        }
示例#4
0
        /// <summary>
        /// Execute
        /// </summary>
        /// <returns></returns>
        protected override bool Execute()
        {
            //Validation of parameters and user have been successful. We may now proceed to read from the database
            var adoGroup = new Group_ADO();

            ADO_readerOutput result;

            //If we're not reading a specific user, then we assume the read is for the userPrincipal
            if (string.IsNullOrEmpty(DTO.CcnUsername))
            {
                DTO.CcnUsername = SamAccountName;
            }

            Account_BSO acBso = new Account_BSO();

            //If this is a Power user or admin, we just return everything
            if (acBso.IsPowerUser(Ado, DTO.CcnUsername) || acBso.IsAdministrator(Ado, DTO.CcnUsername))
            {
                DTO.GrpCode = null;
                result      = adoGroup.Read(Ado, DTO);
            }
            //otherwise we get only the groups for the specified user
            else
            {
                result = adoGroup.ReadAccess(Ado, DTO.CcnUsername);
            }

            if (!result.hasData)
            {
                return(false);
            }

            Response.data = result.data;

            return(true);
        }