コード例 #1
0
ファイル: GadgetSpec.cs プロジェクト: rmatam/ProfilesRNS
        // based on security and securityGroup settings, do we show this?
        public bool Show(string viewerUri, string ownerUri, String page)
        {
            // if it is a sandbox gadget with no match in the db, always show it because
            // this means a developer is trying to test things
            if (unrecognized)
            {
                return(true);
            }
            page = page.ToLower();
            bool show = false;

            if (viewRequirements.ContainsKey(page))
            {
                GadgetViewRequirements req = GetGadgetViewRequirements(page);
                string visibility          = req.GetVisiblity();
                if (OpenSocialManager.PUBLIC.Equals(visibility))
                {
                    show = true;
                }
                else if (OpenSocialManager.USERS.Equals(visibility) && viewerUri != null)
                {
                    show = true;
                }
                else if (OpenSocialManager.PRIVATE.Equals(visibility) && (viewerUri != null) && (viewerUri == ownerUri))
                {
                    show = true;
                }
            }
            return(show);
        }
コード例 #2
0
        // based on security and securityGroup settings, do we show this?
        public bool Show(string viewerUri, string ownerUri, String page)
        {
            page = page.ToLower();
            bool show = true;

            // if there are no view requirements, go ahead and show it.  We are likely testing out a new gadget
            // if there are some, turn it off unless this page says its OK to turn it on
            if (viewRequirements.Count > 0)
            {
                show = false;
            }

            if (viewRequirements.ContainsKey(page))
            {
                GadgetViewRequirements req = GetGadgetViewRequirements(page);
                string visibility          = (req.GetVisiblity() == OpenSocialManager.REGISTRY_DEFINED ? GetRegistryDefinedVisiblity(ownerUri) : req.GetVisiblity());
                if (OpenSocialManager.PUBLIC.Equals(visibility))
                {
                    show = true;
                }
                else if (OpenSocialManager.USERS.Equals(visibility) && viewerUri != null)
                {
                    show = true;
                }
                else if (OpenSocialManager.PRIVATE.Equals(visibility) && (viewerUri != null) && (viewerUri == ownerUri))
                {
                    show = true;
                }
                else if (OpenSocialManager.IS_REGISTERED.Equals(visibility) && GetRegistryDefinedVisiblity(ownerUri) != null)
                {
                    show = true;
                }
            }
            return(show);
        }