Пример #1
0
        public void SetUserApplicationPermission(int userId, ApplicationPermission perms, bool enable)
        {
            UserApplication up = db.SelectObjectWhere <UserApplication> ("UserId={0} AND ApplicationId={1}", userId, application.Id);

            if (up == null)
            {
                if (enable)
                {
                    up = new UserApplication()
                    {
                        UserId = userId, ApplicationId = application.Id, Permissions = perms
                    };
                    db.InsertObject(up);
                }
            }
            else
            {
                if (enable)
                {
                    up.Permissions |= ApplicationPermission.Administer;
                }
                else
                {
                    up.Permissions &= ~ApplicationPermission.Administer;
                }
                db.UpdateObject(up);
            }
        }
Пример #2
0
 internal User GetUserFromOpenId(string identifier)
 {
     return(db.SelectObjectWhere <User> ("OpenId = {0}", identifier));
 }