Пример #1
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;
            }

            //If this is a Power user or admin, we just return everything
            if (Account_BSO_Read.IsPowerUser(Ado, DTO.CcnUsername) || Account_BSO_Read.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);
        }
        /// <summary>
        /// Execute
        /// </summary>
        /// <returns></returns>
        protected override bool Execute()
        {
            if (string.IsNullOrEmpty(DTO.CcnUsername))
            {
                Response.data = Account_BSO_Read.IsAdministrator(Ado, SamAccountName);
            }
            else
            {
                Response.data = Account_BSO_Read.IsAdministrator(Ado, DTO.CcnUsername);
            }


            return(Response.data != null);
        }