Exemplo n.º 1
0
        [Admin] public List <TM_User> users(string usersIds)
        {
            UserGroup.Admin.demand();
            var ids = usersIds.split(",").Select((id) => id.toInt()).toList();

            return(TmWebServices.GetUsers_byID(ids));
        }
Exemplo n.º 2
0
        public string               Article(string articleId)
        {
            var article = TmWebServices.GetGuidanceItemById(articleId.guid());

            return(article.serialize(false));
            //			return article;		// this was failing
        }
Exemplo n.º 3
0
        [Admin] public bool             user_Update(TM_User user)
        {
            UserRole.Admin.demand();
            var groupId = -1;             //not implemented for now

            return(TmWebServices.UpdateUser(user.UserId, user.UserName, user.FirstName, user.LastName, user.Title, user.Company, user.Email, user.Country, user.State, user.ExpirationDate, user.PasswordExpired, user.UserEnabled, user.AccountNeverExpires, groupId));
        }
Exemplo n.º 4
0
        [Admin] public TM_User          user_inDomain(string domain, string user)
        {
            UserRole.Admin.demand();
            var username = "******".format(domain, user);

            return(TmWebServices.GetUser_byName(username));
        }
Exemplo n.º 5
0
        public string Admin_ReloadCache()
        {
            UserGroup.Admin.setThreadPrincipalWithRoles();
            var response = TmWebServices.XmlDatabase_ReloadData();

            UserGroup.Anonymous.setThreadPrincipalWithRoles();
            return(response);
        }
Exemplo n.º 6
0
 [Admin] public bool             user_Delete(string userId)
 {
     if (userId.isInt())
     {
         return(TmWebServices.DeleteUser(userId.toInt()));
     }
     return(false);
 }
Exemplo n.º 7
0
        //RBAC
        public string                   RBAC_CurrentIdentity_Name()
        {
            var currentUser = TmWebServices.Current_User();

            if (currentUser.notNull())
            {
                return(currentUser.UserName);
            }
            return(null);
        }
Exemplo n.º 8
0
        [Admin] public TM_User                      user(string userNameOrId)
        {
            var user = TmWebServices.GetUser_byID(userNameOrId.toInt());

            if (user.notNull())
            {
                return(user);
            }
            return(TmWebServices.GetUser_byName(userNameOrId));
        }
Exemplo n.º 9
0
        public Library_V3           Library(string nameOrId)
        {
            var library = (nameOrId.isGuid())
                              ? TmWebServices.GetLibraryById(nameOrId.guid()).libraryV3()
                              : TmWebServices.GetLibraryByName(nameOrId).libraryV3();

            return((library.notNull())
                       ? TmWebServices.GetFolderStructure_Library(library.libraryId)
                       : null);
        }
Exemplo n.º 10
0
        [Admin] public TM_User                      user(string userNameOrId)
        {
            var user = TmWebServices.GetUser_byName(userNameOrId);              // need to this one first in case the username is an int

            if (user.notNull())
            {
                return(user);
            }
            return(TmWebServices.GetUser_byID(userNameOrId.toInt()));
        }
Exemplo n.º 11
0
 public Stream TBot_List()
 {
     try
     {
         this.response_ContentType_Html();
         return(new TBot_Brain(this).List());
     }
     catch (SecurityException)
     {
         TmWebServices.logUserActivity("Access Denied", "TBot List Command");
         return(Redirect_Login("/tbot"));
     }
 }
Exemplo n.º 12
0
 public string Admin_ReloadCache()
 {
     UserGroup.Admin.assert();                               // temp elevate privileges
     try
     {
         var response = TmWebServices.XmlDatabase_ReloadData();
         return(response);
     }
     finally
     {
         UserGroup.None.assert();
     }
 }
Exemplo n.º 13
0
 public Stream TBot_Json(string what)
 {
     try
     {
         this.response_ContentType_Json();
         return(new TBot_Brain(this).Json(what));
     }
     catch (SecurityException)
     {
         TmWebServices.logUserActivity("Access Denied", "TBot Page (Json): {0}".format(what));
         return("{ 'error': 'SecurityException' }".stream_UFT8());
     }
 }
Exemplo n.º 14
0
 public Stream TBot_Render(string what)
 {
     try
     {
         this.response_ContentType_Html();
         return(new TBot_Brain(this).Render(what));
     }
     catch (SecurityException)
     {
         TmWebServices.logUserActivity("Access Denied", "TBot Page (Render): {0}".format(what));
         return(null);
     }
 }
Exemplo n.º 15
0
        public Stream TBot_Run(string what)
        {
            try
            {
                this.response_ContentType_Html();

                TmWebServices.logUserActivity("Open TBot Page", what);
                return(new TBot_Brain(this).Run(what));
            }
            catch (SecurityException)
            {
                TmWebServices.logUserActivity("Access Denied", "TBot Page (Run): {0}".format(what));
                return(Redirect_Login("/tbot"));
            }
        }
Exemplo n.º 16
0
/*        [Admin] public Guid     GetLoginToken(string username)
 *      {
 *          return TmWebServices.GetLoginToken(username);
 *      }
 *      [Admin] public bool     SendLoginTokenForUser(string userName)
 *      {
 *          var tmUser = userName.tmUser();
 *          if(tmUser.notNull())
 *              return SendEmails.SendLoginTokenToUser(tmUser);
 *          return true;
 *      }*/

        /*public void     Redirect_ToPasswordReset(string email)
         * {
         *  var redirectUrl = "/PasswordReset/{0}".format(SetPasswordResetToken(email));
         *  HttpContextFactory.Response.Redirect(redirectUrl);
         * }*/
/*        [Admin] public void     Redirect_After_Login_Using_Token(string username, string loginToken)
 *      {
 *          var sessionId = TmWebServices.Login_Using_LoginToken(username, loginToken.guid());
 *          if (sessionId != Guid.Empty)
 *              HttpContextFactory.Response.Redirect("/");
 *          else
 *              HttpContextFactory.Response.Redirect("/error");
 *      }*/
        [Admin] public void      Redirect_PasswordResetPage(string userId)
        {
            var tmUser = userId.toInt().tmUser();

            if (tmUser.notNull())
            {
                var token = TmWebServices.NewPasswordResetToken(tmUser.EMail);
                var url   = "/passwordReset/{0}/{1}".format(tmUser.UserName, token);
                HttpContextFactory.Response.Redirect(url);
            }
            else
            {
                "[Redirect_PasswordResetPage] could not find user with user ID: {0}".error(userId);
                HttpContextFactory.Response.Redirect("/error");
            }
        }
Exemplo n.º 17
0
        [Admin] public Stream      Redirect_PasswordResetPage(string userId)
        {
            UserRole.Admin.demand();
            var tmUser = userId.toInt().tmUser();

            if (tmUser.notNull())
            {
                var token = TmWebServices.NewPasswordResetToken(tmUser.EMail);
                var url   = "/passwordReset/{0}/{1}".format(tmUser.UserName, token);
                this.redirect_To_Page(url);
                return("Redirecting to Password Rest Page...\n\n".stream_UFT8());
            }

            this.redirect_To_Page("/error");
            "[Redirect_PasswordResetPage] could not find user with user ID: {0}".error(userId);
            return("Redirecting to Error Page...\n\n".stream_UFT8());
        }
Exemplo n.º 18
0
 public Stream TBot_Run(string what)
 {
     try
     {
         this.response_ContentType_Html();
         //if (what.lower().contains("git"))
         //    Admin_InvokeScript("load_NGit_Dlls");         // to solve prob with NGit dlls not being avaialble for compilation )
         TmWebServices.logUserActivity("Open TBot Page", what);
         return(new TBot_Brain(this).Run(what));
     }
     catch (SecurityException)
     {
         TmWebServices.logUserActivity("Access Denied", "TBot Page (Run): {0}".format(what));
         Redirect_Login("/tbot");
     }
     return(null);
 }
Exemplo n.º 19
0
 [Admin] public List <string> user_Verify(NewUser newUser)
 {
     UserRole.Admin.demand();
     return(TmWebServices.CreateUser_Validate(newUser));
 }
Exemplo n.º 20
0
 [Admin] public bool             user_Save(TM_User user)
 {
     UserRole.Admin.demand();
     return(TmWebServices.UpdateTmUser(user));
 }
Exemplo n.º 21
0
 public bool   SendEmail(EmailMessage_Post emailMessagePost)
 {
     return(TmWebServices.SendEmail(emailMessagePost));
 }
Exemplo n.º 22
0
 public string Admin_Logs()
 {
     return(TmWebServices.GetLogs());
 }
Exemplo n.º 23
0
 public string Admin_Logs_Reset()
 {
     return(TmWebServices.ResetLogs());
 }
Exemplo n.º 24
0
 [Admin] public string        Reload_Cache()
 {
     return(TmWebServices.XmlDatabase_ReloadData());
 }
Exemplo n.º 25
0
 //Admin: User Management
 [Admin] public int              user_New(TM_User user)
 {
     UserRole.Admin.demand();
     return(TmWebServices.CreateUser(user.newUser()));
 }
Exemplo n.º 26
0
 [Admin] public int                      user_Create(NewUser newUser)
 {
     UserRole.Admin.demand();
     return(TmWebServices.CreateUser(newUser));
 }
Exemplo n.º 27
0
 public bool     User_LoggedIn()
 {
     return(TmWebServices.Current_User().notNull());
 }
Exemplo n.º 28
0
 public Guid             Logout()
 {
     return(TmWebServices.Logout());
 }
Exemplo n.º 29
0
 public Guid             Login_using_Credentials(TM_Credentials credentials)
 {
     return(TmWebServices.Login(credentials.UserName, credentials.Password));
 }
Exemplo n.º 30
0
 public Guid             Login(string username, string password)
 {
     return(TmWebServices.Login(username, password));
 }