public RoleAssignment Add(Principal principal, RoleDefinitionBindingCollection roleBindings)
        {
            ClientRuntimeContext context = base.Context;

            if (base.Context.ValidateOnClient)
            {
                if (principal == null)
                {
                    throw ClientUtility.CreateArgumentNullException("principal");
                }
                if (roleBindings == null)
                {
                    throw ClientUtility.CreateArgumentNullException("roleBindings");
                }
            }
            RoleAssignment roleAssignment = new RoleAssignment(context, new ObjectPathMethod(context, base.Path, "Add", new object[]
            {
                principal,
                roleBindings
            }));

            roleAssignment.Path.SetPendingReplace();
            ObjectIdentityQuery objectIdentityQuery = new ObjectIdentityQuery(roleAssignment.Path);

            context.AddQueryIdAndResultObject(objectIdentityQuery.Id, roleAssignment);
            context.AddQuery(objectIdentityQuery);
            base.AddChild(roleAssignment);
            return(roleAssignment);
        }
Esempio n. 2
0
        public void ImportRoleDefinitionBindings(RoleDefinitionBindingCollection roleDefinitionBindings)
        {
            ClientRuntimeContext context = base.Context;
            ClientAction         query   = new ClientActionInvokeMethod(this, "ImportRoleDefinitionBindings", new object[]
            {
                roleDefinitionBindings
            });

            context.AddQuery(query);
        }