Exemplo n.º 1
0
    //回傳的 User 就是已經被設定到其他類型了(every/super/guest)
    private User IsSubjectCanBeAssigned(User[] users, string excludeGroup)
    {
        User everyone = new EveryoneUserUtil().GetEveryoneUser();
        User[] guests = new GuestUserUtil().GetGuestUsers();
        User[] superUsers = new SuperUserUtil().GetSuperUsers();

        List<User> list = new List<User>();
        if(excludeGroup=="superuser")
        {
            list.Add(everyone);
            list.AddRange(guests);
        }
        if(excludeGroup=="everyone")
        {
            list.AddRange(guests);
            list.AddRange(superUsers);
        }

        if(excludeGroup=="guest")
        {
            list.AddRange(superUsers);
            list.Add(everyone);
        }

        foreach (User x in users)
        {
            foreach (User u in list)
            {
                if (x.SubjectId == u.SubjectId)
                {
                    return x;
                }
            }
        }

        return null;
    }
Exemplo n.º 2
0
 private void GetGuest()
 {
     try
     {
         User[] ss = new GuestUserUtil().GetGuestUsers();
         WebUtility.WriteAjaxResult(true, null, ss);
     }
     catch (Exception E)
     {
         WebUtility.WriteAjaxError(E.Message, E);
     }
 }