示例#1
0
        static internal async Task setACL <T>(OpenChainSession ad, String assetPath, T acl) where T : class
        {
            var assetACL = await ad.GetData <T>(assetPath, "acl");

            assetACL.Value = acl;
            await ad.SetData(assetACL);
        }
示例#2
0
        static internal async Task SetAdminACL(OpenChainSession ad, String CommunityHandle, String adminPubKey)
        {
            //set asset ACL
            await setACL(ad, getTreasuryPath(CommunityHandle), new[] { new {
                                                                           subjects = new [] { new {
                                                                                                   addresses = new[] { adminPubKey },
                                                                                                   required  = 1
                                                                                               } },
                                                                           permissions = new { account_negative = "Permit", account_modify = "Permit" }
                                                                       } });

            //set user ACL
            await setACL(ad, USERFOLDER, new[] {
                new {
                    subjects = new [] { new {
                                            addresses = new String[]  { adminPubKey },
                                            required  = 1
                                        } },
                    permissions = (object)new { account_create = "Permit", account_modify = "Permit", account_spend = "Permit" }
                },
                new {
                    subjects = new [] { new {
                                            addresses = new String[] { },
                                            required  = 0
                                        } },
                    permissions = (object)new { account_modify = "Permit" }
                },
            });
        }
示例#3
0
        static async Task updateLedgerInfo(OpenChainSession ad, Models.OCCommunityInfo community)
        {
            var ir = await ad.GetData <LedgerInfo>("/", "info");

            ir.Value = new LedgerInfo {
                Name = community.full_name, TermsOfService = community.description
            };
            await ad.SetData(ir);
        }
示例#4
0
        static async Task <T> getACL <T>(OpenChainSession ad, String assetPath, T format) where T : class
        {
            var assetACL = await ad.GetData <T>(assetPath, "acl");

            return(assetACL.Value);
        }