コード例 #1
0
        internal static SharedFacet CreateFromPermissions(Permission[] permissions)
        {
            if (null == permissions || permissions.Length == 0)
            {
                return(null);
            }

            SharedFacet facet           = new SharedFacet();
            SharedScope discoveredScope = SharedScope.None;

            foreach (var perm in permissions)
            {
                if (perm.Link != null && perm.Link.Scope == "organization")
                {
                    discoveredScope = (SharedScope.Tenant > discoveredScope) ? SharedScope.Tenant : discoveredScope;
                }
                else if (perm.Link != null && perm.Link.Scope == "anonymous")
                {
                    discoveredScope = (SharedScope.Anonymous > discoveredScope) ? SharedScope.Anonymous : discoveredScope;
                }

                if (perm.GrantedTo != null)
                {
                    discoveredScope = (SharedScope.Users > discoveredScope) ? SharedScope.Users : discoveredScope;
                }
            }

            facet.Scope = discoveredScope.ToString().ToLower();
            return(facet);
        }
コード例 #2
0
        internal static SharedFacet CreateFromPermissions(Permission[] permissions)
        {
            if (null == permissions || permissions.Length == 0)
                return null;

            SharedFacet facet = new SharedFacet();
            SharedScope discoveredScope = SharedScope.None;
            foreach (var perm in permissions)
            {
                if (perm.Link != null && perm.Link.Scope == "organization")
                {
                    discoveredScope = (SharedScope.Tenant > discoveredScope) ? SharedScope.Tenant : discoveredScope;
                }
                else if (perm.Link != null && perm.Link.Scope == "anonymous")
                {
                    discoveredScope = (SharedScope.Anonymous > discoveredScope) ? SharedScope.Anonymous : discoveredScope;
                }

                if (perm.GrantedTo != null)
                {
                    discoveredScope = (SharedScope.Users > discoveredScope) ? SharedScope.Users : discoveredScope;
                }
            }

            facet.Scope = discoveredScope.ToString().ToLower();
            return facet;
        }