Пример #1
0
        public Checkin CheckInPUT(User u, APISession session, DynamicDictionary parms)
        {
            Checkin t = this.Bind();
            t.RegisteredBy = u.UserId;

            // Check roles to see if the user can post
            if (!u.IsAdmin() || t.UserId == 0)
            {
                t.UserId = u.UserId;
            }

            return Checkin.CheckIn(t);
        }
Пример #2
0
 public Checkin CheckOut(User u, APISession session, DynamicDictionary parms)
 {
     if (u.IsAdmin())
     {
         return Checkin.CheckOut(parms["id"]);
     }
     else
     {
         Checkin cin = Checkin.GetLastForUser(u.UserId);
         if (cin.EndTime.HasValue)
         {
             return cin;
         }
         return Checkin.CheckOut(cin.CheckInId);
     }
 }
Пример #3
0
        public UserInfo UpdateUser(User u, APISession session, DynamicDictionary parameters)
        {
            UserInfo s = this.Bind<UserInfo>(new string[]{"EntityKey", "EntityState"});

            if (s.UserId != u.UserId && !u.IsAdmin())
            {
                throw new AccessException(i18n.API_ErrorSessionPrivilegesRequired);
            }

            return UserInfo.Save(s);
        }