Marcin Kuzminski avatar Marcin Kuzminski committed 4b17216

Deprecated validation of operating system, we just care if it's windows, let approve all other
systems.
- help to supports cases like cygwin etc
- fixed typo in auth decorator

Comments (0)

Files changed (2)

rhodecode/__init__.py

 __url__ = 'http://rhodecode.org'
 
 PLATFORM_WIN = ('Windows')
-PLATFORM_OTHERS = ('Linux', 'Darwin', 'FreeBSD', 'OpenBSD', 'SunOS')
+PLATFORM_OTHERS = ('Linux', 'Darwin', 'FreeBSD', 'OpenBSD', 'SunOS') #depracated
 
 is_windows = __platform__ in PLATFORM_WIN
-is_unix = __platform__ in PLATFORM_OTHERS
+is_unix = not is_windows
 
 
 BACKENDS = {

rhodecode/lib/auth.py

 from pylons.controllers.util import abort, redirect
 from pylons.i18n.translation import _
 
-from rhodecode import __platform__, PLATFORM_WIN, PLATFORM_OTHERS
+from rhodecode import __platform__, is_windows, is_unix
 from rhodecode.model.meta import Session
 
 from rhodecode.lib.utils2 import str2bool, safe_unicode
 
         :param password: password to hash
         """
-        if __platform__ in PLATFORM_WIN:
+        if is_windows:
             from hashlib import sha256
             return sha256(str_).hexdigest()
-        elif __platform__ in PLATFORM_OTHERS:
+        elif is_unix:
             import bcrypt
             return bcrypt.hashpw(str_, bcrypt.gensalt(10))
         else:
         :param hashed: password in hashed form
         """
 
-        if __platform__ in PLATFORM_WIN:
+        if is_windows:
             from hashlib import sha256
             return sha256(password).hexdigest() == hashed
-        elif __platform__ in PLATFORM_OTHERS:
+        elif is_unix:
             import bcrypt
             return bcrypt.hashpw(password, hashed) == hashed
         else:
                                           user_attrs):
                     log.info('created new ldap user %s' % username)
 
-                Session.commit()
+                Session().commit()
                 return True
             except (LdapUsernameError, LdapPasswordError,):
                 pass
         return None
 
     user.update_lastlogin()
-    Session.commit()
+    Session().commit()
 
     log.debug('User %s is now logged in by container authentication',
               user.username)
 class HasReposGroupPermissionAll(PermsFunction):
     def __call__(self, group_name=None, check_Location=''):
         self.group_name = group_name
-        return super(HasReposGroupPermissionAny, self).__call__(check_Location)
+        return super(HasReposGroupPermissionAll, self).__call__(check_Location)
 
     def check_permissions(self):
         try:
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.