コード例 #1
0
        /// <summary>
        /// 删除关联信息
        /// </summary>
        /// <typeparam name="T">泛型</typeparam>
        /// <param name="column">字段</param>
        /// <param name="values">关联信息</param>
        /// <returns></returns>
        public IBmobOperator RemoveRelation <T>(String column, BmobRelation <T> values) where T : BmobTable
        {
            var value = new RemoveRelation <T>();

            value.objects = values;
            return(handle(column, value));
        }
コード例 #2
0
ファイル: BmobRole.cs プロジェクト: xuanyuan52/BmobSharp
        public override void readFields(BmobInput input)
        {
            base.readFields(input);

            this.name = input.getString("name");
            this.users = input.Get<BmobRelation<BmobUser>>("users");
            this.roles = input.Get<BmobRelation<BmobRole>>("roles");
        }
コード例 #3
0
ファイル: BmobRole.cs プロジェクト: xuanyuan52/BmobSharp
        public override void readFields(BmobInput input)
        {
            base.readFields(input);

            this.name  = input.getString("name");
            this.users = input.Get <BmobRelation <BmobUser> >("users");
            this.roles = input.Get <BmobRelation <BmobRole> >("roles");
        }
コード例 #4
0
        public void RoleTest()
        {
            //这里创建四个用户对象指针,分别为老板、人事小张、出纳小谢和自己
            // just for test
            BmobPointer <BmobUser> boss = new BmobUser()
            {
                objectId = "1"
            };
            BmobPointer <BmobUser> hr_zhang = new BmobUser()
            {
                objectId = "2"
            };
            BmobPointer <BmobUser> hr_luo = new BmobUser()
            {
                objectId = "3"
            };
            BmobPointer <BmobUser> cashier_xie = new BmobUser()
            {
                objectId = "4"
            };
            BmobPointer <BmobUser> me = new BmobUser()
            {
                objectId = "5"
            };

            {
                //创建HR和Cashier两个用户角色(这里为了举例BmobRole的使用,将这段代码写在这里,正常情况下放在员工管理界面会更合适)
                BmobRole hr = new BmobRole();
                hr.name = "HR";
                var users = new BmobRelation <BmobUser>();
                users.Add(hr_zhang);
                users.Add(hr_luo);

                //将hr_zhang和hr_luo归属到hr角色中
                hr.AddUsers(users);

                //保存到云端角色表中(web端可以查看Role表)
                var future = Bmob.CreateTaskAsync(hr);
                FinishedCallback(future.Result, null);
            }

            {
                BmobRole cashier = new BmobRole();
                cashier.name = "Cashier";
                var users = new BmobRelation <BmobUser>();
                users.Add(cashier_xie);

                //将cashier_xie归属到cashier角色中
                cashier.AddUsers(users);

                //保存到云端角色表中(web端可以查看Role表)
                var future = Bmob.CreateTaskAsync(cashier);
                FinishedCallback(future.Result, null);
            }
        }
コード例 #5
0
ファイル: BmobTask.cs プロジェクト: jango2015/BmobSharp
        public void RoleTest()
        {
            //这里创建四个用户对象指针,分别为老板、人事小张、出纳小谢和自己
            // just for test
            BmobPointer<BmobUser> boss = new BmobUser() { objectId = "1" };
            BmobPointer<BmobUser> hr_zhang = new BmobUser() { objectId = "2" };
            BmobPointer<BmobUser> hr_luo = new BmobUser() { objectId = "3" };
            BmobPointer<BmobUser> cashier_xie = new BmobUser() { objectId = "4" };
            BmobPointer<BmobUser> me = new BmobUser() { objectId = "5" };

            {
                //创建HR和Cashier两个用户角色(这里为了举例BmobRole的使用,将这段代码写在这里,正常情况下放在员工管理界面会更合适)
                BmobRole hr = new BmobRole();
                hr.name = "HR";
                var users = new BmobRelation<BmobUser>();
                users.Add(hr_zhang);
                users.Add(hr_luo);

                //将hr_zhang和hr_luo归属到hr角色中
                hr.AddUsers(users);

                //保存到云端角色表中(web端可以查看Role表)
                var future = Bmob.CreateTaskAsync(hr);
                FinishedCallback(future.Result, null);
            }

            {
                BmobRole cashier = new BmobRole();
                cashier.name = "Cashier";
                var users = new BmobRelation<BmobUser>();
                users.Add(cashier_xie);

                //将cashier_xie归属到cashier角色中
                cashier.AddUsers(users);

                //保存到云端角色表中(web端可以查看Role表)
                var future = Bmob.CreateTaskAsync(cashier);
                FinishedCallback(future.Result, null);
            }
        }
コード例 #6
0
 public BmobRole RemoveRoles(BmobRelation <BmobRole> value)
 {
     RemoveRelation("roles", value);
     return(this);
 }
コード例 #7
0
 /// <summary>
 /// 一个角色可以包含另一个,可以为 2 个角色建立一个父-子关系。 这个关系的结果就是任何被授予父角色的权限隐含地被授予子角色。
 ///
 /// 这样的关系类型通常在用户管理的内容类的应用上比较常见, 比如在论坛中,有一些少数的用户是 "管理员(Administartors)", 有最高的权限,可以调整系统设置、 创建新的论坛等等。 另一类用户是 "版主(Moderators)",他们可以对用户发帖的内容进行管理。可见,任何有管理员权限的人都应该有版主的权限。为建立起这种关系, 您应该把 "Administartors" 的角色设置为 "Moderators" 的子角色, 具体来说就是把 "Administrators" 这个角色加入 "Moderators" 对象的 roles 关系之中
 /// </summary>
 public BmobRole AddRoles(BmobRelation <BmobRole> value)
 {
     AddRelation("roles", value);
     return(this);
 }
コード例 #8
0
 public BmobRole RemoveUsers(BmobRelation <BmobUser> value)
 {
     RemoveRelation("users", value);
     return(this);
 }
コード例 #9
0
 public BmobRole AddUsers(BmobRelation <BmobUser> value)
 {
     AddRelation("users", value);
     return(this);
 }
コード例 #10
0
 public BmobRole RemoveRoles(BmobRelation<BmobRole> value)
 {
     RemoveRelation("roles", value);
     return this;
 }
コード例 #11
0
 /// <summary>
 /// 一个角色可以包含另一个,可以为 2 个角色建立一个父-子关系。 这个关系的结果就是任何被授予父角色的权限隐含地被授予子角色。
 ///
 /// 这样的关系类型通常在用户管理的内容类的应用上比较常见, 比如在论坛中,有一些少数的用户是 "管理员(Administartors)", 有最高的权限,可以调整系统设置、 创建新的论坛等等。 另一类用户是 "版主(Moderators)",他们可以对用户发帖的内容进行管理。可见,任何有管理员权限的人都应该有版主的权限。为建立起这种关系, 您应该把 "Administartors" 的角色设置为 "Moderators" 的子角色, 具体来说就是把 "Administrators" 这个角色加入 "Moderators" 对象的 roles 关系之中
 /// </summary>
 public BmobRole AddRoles(BmobRelation<BmobRole> value)
 {
     AddRelation("roles", value);
     return this;
 }
コード例 #12
0
 public BmobRole RemoveUsers(BmobRelation<BmobUser> value)
 {
     RemoveRelation("users", value);
     return this;
 }
コード例 #13
0
 public BmobRole AddUsers(BmobRelation<BmobUser> value)
 {
     AddRelation("users", value);
     return this;
 }