Example #1
0
        /*--------------------------------------------------------------------------------------------*/
        private void AddMember(SetupMemberId pId, SetupAppId pSetupAppId, SetupUserId pSetupUserId,
                               MemberType.Id pMemTypeId)
        {
            var m = new Member();

            m.MemberType = (byte)pMemTypeId;
            AddVertex(m, (SetupVertexId)(long)pId);

            App  app  = Data.GetVertex <App>((long)pSetupAppId);
            User user = Data.GetVertex <User>((long)pSetupUserId);

            var adm = new AppDefinesMember();

            adm.Timestamp  = m.Timestamp;
            adm.MemberType = m.MemberType;
            adm.UserId     = (long)pSetupUserId;
            AddEdge(app, adm, m);
            AddEdge(m, new MemberDefinedByApp(), app);

            var udm = new UserDefinesMember();

            udm.Timestamp  = m.Timestamp;
            udm.MemberType = m.MemberType;
            udm.AppId      = (long)pSetupAppId;
            AddEdge(user, udm, m);
            AddEdge(m, new MemberDefinedByUser(), user);
        }
Example #2
0
        /*--------------------------------------------------------------------------------------------*/
        private void AddApp(SetupAppId pId, string pName, SetupEmailId pSetupEmailId, string pSecret)
        {
            var a = new App();

            a.Name    = pName;
            a.NameKey = pName.ToLower();
            a.Secret  = pSecret;
            AddArtifact(a, (SetupArtifactId)(long)pId);
            AddArtifactEmailLink(a, pSetupEmailId);
        }
Example #3
0
        /*--------------------------------------------------------------------------------------------*/
        public void Create()
        {
            const SetupAppId fab  = SetupAppId.FabSys;
            const SetupAppId gal  = SetupAppId.KinPhoGal;
            const SetupAppId book = SetupAppId.Bookmarker;

            var now = new DateTime(Data.NowTimestamp);

            IsForTestingOnly = false;
            AddDomain(fab, DomFab1);
            AddDomain(fab, DomFab2);
            IsForTestingOnly = true;
            AddDomain(gal, DomGal1);
            AddDomain(gal, DomGal2);
            AddDomain(book, DomBook1);
            AddDomain(book, DomBook2);

            AddAccess(OauthAccessId.GalZach_Past, SetupMemberId.GalZach, null, -320);
            AddAccess(OauthAccessId.GalMel_Past, SetupMemberId.GalMel, null, -301);
            AddAccess(OauthAccessId.GalGalData_Past, SetupMemberId.GalGalData, null, -222);
            AddAccess(OauthAccessId.GalEllie_Past, SetupMemberId.GalEllie, TokenGalEllieExp, -186);             //not refreshed
            AddAccess(OauthAccessId.BookBookData_Past, SetupMemberId.BookBookData, null, -143);
            AddAccess(OauthAccessId.BookMel_Past, SetupMemberId.BookMel, null, -3);
            AddAccess(OauthAccessId.GalZach, SetupMemberId.GalZach, TokenGalZach, 2, RefreshGalZach);
            AddAccess(OauthAccessId.GalMel, SetupMemberId.GalMel, TokenGalMel, 7);
            AddAccess(OauthAccessId.GalGalData, SetupMemberId.GalGalData, TokenGalGalData, 18);
            AddAccess(OauthAccessId.BookZach, SetupMemberId.BookZach, TokenBookZach, 35);
            AddAccess(OauthAccessId.BookMel, SetupMemberId.BookMel, TokenBookMel, 57);
            AddAccess(OauthAccessId.FabZach, SetupMemberId.FabZach, TokenFabZach, 62);

            AddGrant(SetupMemberId.BookZach, GrantBookZachPast, GrantUrlBook, now.AddMinutes(-3));
            AddGrant(SetupMemberId.GalMel, GrantGalMel, GrantUrlGal, now.AddMinutes(20));
            AddGrant(SetupMemberId.GalZach, GrantGalZach, GrantUrlGalLoc, now.AddMinutes(25));
            AddGrant(SetupMemberId.GalPenny, GrantGalPenny, GrantUrlGalS, now.AddMinutes(32));
            AddGrant(SetupMemberId.BookMel, GrantBookMel, GrantUrlBook, now.AddMinutes(47));

            AddScope(SetupMemberId.FabFabData, true);
            AddScope(SetupMemberId.GalZach, true);
            AddScope(SetupMemberId.GalPenny, true);
            AddScope(SetupMemberId.GalMel, true);
            AddScope(SetupMemberId.GalGalData, true);
            AddScope(SetupMemberId.GalEllie, true);
            AddScope(SetupMemberId.BookZach, true);
            AddScope(SetupMemberId.BookBookData, true);
            AddScope(SetupMemberId.BookMel, true);
            AddScope(SetupMemberId.BookEllie, false);
            AddScope(SetupMemberId.BookPenny, false);
        }
Example #4
0
        ////////////////////////////////////////////////////////////////////////////////////////////////
        /*--------------------------------------------------------------------------------------------*/
        private void AddDomain(SetupAppId pAppId, string pDomain)
        {
            App a = Data.GetVertex <App>((long)pAppId);

            a.OauthDomains += (string.IsNullOrEmpty(a.OauthDomains) ? "" : "|") + pDomain;
        }