##// END OF EJS Templates
Better descriptions of given permission overview in edit user view
marcink -
r2532:19de74e3 beta
parent child Browse files
Show More
@@ -479,33 +479,12 b' class DbManage(object):'
479 def create_permissions(self):
479 def create_permissions(self):
480 # module.(access|create|change|delete)_[name]
480 # module.(access|create|change|delete)_[name]
481 # module.(none|read|write|admin)
481 # module.(none|read|write|admin)
482 perms = [
483 ('repository.none', 'Repository no access'),
484 ('repository.read', 'Repository read access'),
485 ('repository.write', 'Repository write access'),
486 ('repository.admin', 'Repository admin access'),
487
482
488 ('group.none', 'Repositories Group no access'),
483 for p in Permission.PERMS:
489 ('group.read', 'Repositories Group read access'),
490 ('group.write', 'Repositories Group write access'),
491 ('group.admin', 'Repositories Group admin access'),
492
493 ('hg.admin', 'Hg Administrator'),
494 ('hg.create.repository', 'Repository create'),
495 ('hg.create.none', 'Repository creation disabled'),
496 ('hg.register.none', 'Register disabled'),
497 ('hg.register.manual_activate', 'Register new user with RhodeCode '
498 'without manual activation'),
499
500 ('hg.register.auto_activate', 'Register new user with RhodeCode '
501 'without auto activation'),
502 ]
503
504 for p in perms:
505 if not Permission.get_by_key(p[0]):
484 if not Permission.get_by_key(p[0]):
506 new_perm = Permission()
485 new_perm = Permission()
507 new_perm.permission_name = p[0]
486 new_perm.permission_name = p[0]
508 new_perm.permission_longname = p[1]
487 new_perm.permission_longname = p[0]
509 self.sa.add(new_perm)
488 self.sa.add(new_perm)
510
489
511 def populate_default_permissions(self):
490 def populate_default_permissions(self):
@@ -46,7 +46,7 b' from rhodecode.lib.vcs.exceptions import'
46 from rhodecode.lib.vcs.backends.base import BaseChangeset
46 from rhodecode.lib.vcs.backends.base import BaseChangeset
47 from rhodecode.config.conf import DATE_FORMAT, DATETIME_FORMAT
47 from rhodecode.config.conf import DATE_FORMAT, DATETIME_FORMAT
48 from rhodecode.model.changeset_status import ChangesetStatusModel
48 from rhodecode.model.changeset_status import ChangesetStatusModel
49 from rhodecode.model.db import URL_SEP
49 from rhodecode.model.db import URL_SEP, Permission
50
50
51 log = logging.getLogger(__name__)
51 log = logging.getLogger(__name__)
52
52
@@ -1007,3 +1007,7 b' def changeset_status(repo, revision):'
1007
1007
1008 def changeset_status_lbl(changeset_status):
1008 def changeset_status_lbl(changeset_status):
1009 return dict(ChangesetStatus.STATUSES).get(changeset_status)
1009 return dict(ChangesetStatus.STATUSES).get(changeset_status)
1010
1011
1012 def get_permission_name(key):
1013 return dict(Permission.PERMS).get(key)
@@ -1058,6 +1058,28 b' class Permission(Base, BaseModel):'
1058 {'extend_existing': True, 'mysql_engine': 'InnoDB',
1058 {'extend_existing': True, 'mysql_engine': 'InnoDB',
1059 'mysql_charset': 'utf8'},
1059 'mysql_charset': 'utf8'},
1060 )
1060 )
1061 PERMS = [
1062 ('repository.none', _('Repository no access')),
1063 ('repository.read', _('Repository read access')),
1064 ('repository.write', _('Repository write access')),
1065 ('repository.admin', _('Repository admin access')),
1066
1067 ('group.none', _('Repositories Group no access')),
1068 ('group.read', _('Repositories Group read access')),
1069 ('group.write', _('Repositories Group write access')),
1070 ('group.admin', _('Repositories Group admin access')),
1071
1072 ('hg.admin', _('RhodeCode Administrator')),
1073 ('hg.create.none', _('Repository creation disabled')),
1074 ('hg.create.repository', _('Repository creation enabled')),
1075 ('hg.register.none', _('Register disabled')),
1076 ('hg.register.manual_activate', _('Register new user with RhodeCode '
1077 'with manual activation')),
1078
1079 ('hg.register.auto_activate', _('Register new user with RhodeCode '
1080 'with auto activation')),
1081 ]
1082
1061 permission_id = Column("permission_id", Integer(), nullable=False, unique=True, default=None, primary_key=True)
1083 permission_id = Column("permission_id", Integer(), nullable=False, unique=True, default=None, primary_key=True)
1062 permission_name = Column("permission_name", String(length=255, convert_unicode=False, assert_unicode=None), nullable=True, unique=None, default=None)
1084 permission_name = Column("permission_name", String(length=255, convert_unicode=False, assert_unicode=None), nullable=True, unique=None, default=None)
1063 permission_longname = Column("permission_longname", String(length=255, convert_unicode=False, assert_unicode=None), nullable=True, unique=None, default=None)
1085 permission_longname = Column("permission_longname", String(length=255, convert_unicode=False, assert_unicode=None), nullable=True, unique=None, default=None)
@@ -186,14 +186,14 b''
186 %elif section == 'repositories_groups':
186 %elif section == 'repositories_groups':
187 <a href="${h.url('repos_group_home',group_name=k)}">${k}</a>
187 <a href="${h.url('repos_group_home',group_name=k)}">${k}</a>
188 %else:
188 %else:
189 ${k}
189 ${h.get_permission_name(k)}
190 %endif
190 %endif
191 </td>
191 </td>
192 <td>
192 <td>
193 %if section == 'global':
193 %if section == 'global':
194 ${h.bool2icon(True)}
194 ${h.bool2icon(k.split('.')[-1] != 'none')}
195 %else:
195 %else:
196 <span class="perm_tag ${_perm}">${section_perm}</span>
196 <span class="perm_tag ${_perm}">${section_perm}</span>
197 %endif
197 %endif
198 </td>
198 </td>
199 </tr>
199 </tr>
@@ -204,7 +204,7 b''
204 %endfor
204 %endfor
205 </div>
205 </div>
206 </div>
206 </div>
207 <div class="box box-right">
207 <div class="box box-left">
208 <!-- box / title -->
208 <!-- box / title -->
209 <div class="title">
209 <div class="title">
210 <h5>${_('Email addresses')}</h5>
210 <h5>${_('Email addresses')}</h5>
General Comments 0
You need to be logged in to leave comments. Login now