public void Owner_ReadOnly()
        {
            var sut    = new AuthorizationScope(AuthorizationRole.Owner, AuthorizationPermission.ReadOnly);
            var result = sut.ToString();

            Assert.AreEqual("owner,ro", result);
        }
        public void User_ReadWrite()
        {
            var sut    = new AuthorizationScope(AuthorizationRole.User, AuthorizationPermission.ReadWrite);
            var result = sut.ToString();

            Assert.AreEqual("user,rw", result);
        }
        public void Admin_ReadOnly()
        {
            var sut    = new AuthorizationScope(AuthorizationRole.Admin, AuthorizationPermission.ReadOnly);
            var result = sut.ToString();

            Assert.AreEqual("admin,ro", result);
        }
예제 #4
0
        internal static string GetAuthorizationName(this AuthorizationScope scope)
        {
            switch (scope)
            {
            case AuthorizationScope.ReadBasicProfile:
                return("r_basicprofile");

            case AuthorizationScope.ReadFullProfile:
                return("r_fullprofile");

            case AuthorizationScope.ReadEmailAddress:
                return("r_emailaddress");

            case AuthorizationScope.ReadNetwork:
                return("r_network");

            case AuthorizationScope.ReadContactInfo:
                return("r_contactinfo");

            case AuthorizationScope.ReadWriteNetworkUpdates:
                return("rw_nus");

            case AuthorizationScope.ReadWriteCompanyPage:
                return("rw_company_admin");

            case AuthorizationScope.ReadWriteGroups:
                return("rw_groups");

            case AuthorizationScope.WriteMessages:
                return("w_messages");

            case AuthorizationScope.WriteShare:
                return("w_share");

            case AuthorizationScope.ReadWriteOrganization:
                return("rw_organization");

            case AuthorizationScope.ReadFirstConnectionsSize:
                return("r_1st_connections_size");

            case AuthorizationScope.ReadLiteProfile:
                return("r_liteprofile");

            case AuthorizationScope.ReadAdsReporting:
                return("r_ads_reporting");

            case AuthorizationScope.ReadOrganizationSocial:
                return("r_organization_social");

            default:
                throw new NotSupportedException("Scope of value '" + scope.ToString() + " is not supported");
            }
        }
예제 #5
0
        internal static string GetAuthorizationName(this AuthorizationScope scope)
        {
            switch (scope)
            {
            case AuthorizationScope.ReadBasicProfile:
                return("r_basicprofile");

            case AuthorizationScope.ReadFullProfile:
                return("r_fullprofile");

            case AuthorizationScope.ReadEmailAddress:
                return("r_emailaddress");

            case AuthorizationScope.ReadNetwork:
                return("r_network");

            case AuthorizationScope.ReadContactInfo:
                return("r_contactinfo");

            case AuthorizationScope.ReadWriteNetworkUpdates:
                return("rw_nus");

            case AuthorizationScope.ReadWriteCompanyPage:
                return("rw_company_admin");

            case AuthorizationScope.ReadWriteGroups:
                return("rw_groups");

            case AuthorizationScope.WriteMessages:
                return("w_messages");

            case AuthorizationScope.WriteShare:
                return("w_share");

            default:
                throw new NotSupportedException("Scope of value '" + scope.ToString() + " is not supported");
            }
        }