realm-user-profile.html 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372
  1. <div class="col-sm-9 col-md-10 col-sm-push-3 col-md-push-2">
  2. <kc-tabs-realm></kc-tabs-realm>
  3. <ul class="nav nav-tabs nav-tabs-pf">
  4. <li ng-class="{active: isShowAttributes}"><a href="" data-ng-click="showAttributes()">{{:: 'attributes' | translate}}</a></li>
  5. <li ng-class="{active: isShowAttributeGroups}"><a href=""
  6. data-ng-click="showAttributeGroups()">{{:: 'attribute-groups' | translate}}</a>
  7. <li ng-class="{active: isShowJsonEditor}"><a href=""
  8. data-ng-click="showJsonEditor()">{{:: 'client-profiles-json-editor' | translate}}</a>
  9. </li>
  10. </ul>
  11. <div data-ng-show="showAttributeListing()">
  12. <table class="datatable table table-striped table-bordered dataTable no-footer">
  13. <thead>
  14. <tr>
  15. <th class="kc-table-actions" colspan="5">
  16. <div class="form-inline">
  17. <div class="pull-right" data-ng-show="access.manageClients">
  18. <button class="btn btn-default" data-ng-click="createAttribute()">
  19. {{:: 'create' | translate}}
  20. </button>
  21. </div>
  22. </div>
  23. </th>
  24. </tr>
  25. <tr>
  26. <th width="25%">{{:: 'name' | translate}}</th>
  27. <th width="40%">{{:: 'user.profile.attribute.displayName' | translate}}</th>
  28. <th width="25%">{{:: 'user.profile.attribute.group' | translate}}</th>
  29. <th colspan="2">{{:: 'actions' | translate}}</th>
  30. </tr>
  31. </thead>
  32. <tbody>
  33. <tr ng-repeat="attribute in config.attributes">
  34. <td class="kc-sorter">
  35. <button data-ng-hide="flow.builtIn" data-ng-disabled="$first" class="btn btn-default btn-sm" data-ng-click="guiOrderUp($index)"><i class="fa fa-angle-up"></i></button>
  36. <button data-ng-hide="flow.builtIn" data-ng-disabled="$last" class="btn btn-default btn-sm" data-ng-click="guiOrderDown($index)"><i class="fa fa-angle-down"></i></button>
  37. <span><a href="" data-ng-click="editAttribute(attribute)">{{attribute.name}}</a></span>
  38. </td>
  39. <td>{{attribute.displayName}}</td>
  40. <td>{{attribute.group}}</td>
  41. <td class="kc-action-cell" data-ng-click="editAttribute(attribute)">{{:: 'edit' | translate}}</td>
  42. <td class="kc-action-cell" data-ng-click="removeAttribute(attribute)">{{:: 'delete' | translate}}</td>
  43. </tr>
  44. </tbody>
  45. </table>
  46. </div>
  47. <div data-ng-show="showAttributeGroupListing()">
  48. <table class="datatable table table-striped table-bordered dataTable no-footer">
  49. <thead>
  50. <tr>
  51. <th class="kc-table-actions" colspan="5">
  52. <div class="form-inline">
  53. <div class="pull-right" data-ng-show="access.manageClients">
  54. <button class="btn btn-default" data-ng-click="createAttributeGroup()">
  55. {{:: 'create' | translate}}
  56. </button>
  57. </div>
  58. </div>
  59. </th>
  60. </tr>
  61. <tr>
  62. <th width="25%">{{:: 'name' | translate}}</th>
  63. <th width="25%">{{:: 'user.profile.attributegroup.displayHeader' | translate}}</th>
  64. <th width="40%">{{:: 'user.profile.attributegroup.displayDescription' | translate}}</th>
  65. <th colspan="2">{{:: 'actions' | translate}}</th>
  66. </tr>
  67. </thead>
  68. <tbody>
  69. <tr ng-repeat="group in config.groups">
  70. <td class="kc-sorter">
  71. <span><a href="" data-ng-click="editAttributeGroup(group)">{{group.name}}</a></span>
  72. </td>
  73. <td>{{group.displayHeader}}</td>
  74. <td>{{group.displayDescription}}</td>
  75. <td class="kc-action-cell" data-ng-click="editAttributeGroup(group)">{{:: 'edit' | translate}}</td>
  76. <!-- show delete button enabled/disabled depending whether it is referenced in any attribute -->
  77. <td class="kc-action-cell" ng-if="!(groupIsReferencedInAnyAttribute(group))" data-ng-click="removeAttributeGroup(group)">{{:: 'delete' | translate}}</td>
  78. <td class="kc-action-cell-disabled" ng-if="(groupIsReferencedInAnyAttribute(group))" align="center" >{{:: 'delete' | translate}}</td>
  79. </tr>
  80. </tbody>
  81. </table>
  82. </div>
  83. <form class="form-horizontal" name="realmForm" novalidate kc-read-only="!access.manageRealm"
  84. data-ng-show="isShowJsonEditor">
  85. <filedset>
  86. <div class="form-group">
  87. <div class="col-md-10">
  88. <div>
  89. <textarea id="userProfileConfig" name="userProfileConfig" data-ng-model="rawConfig"
  90. class="form-control ng-binding" rows="20"></textarea>
  91. </div>
  92. </div>
  93. </div>
  94. <div class="form-group">
  95. <div class="col-md-10">
  96. <button class="btn btn-primary" data-ng-click="save()">{{:: 'save' | translate}}</button>
  97. <button class="btn btn-default" data-ng-click="reset()">{{:: 'cancel' | translate}}</button>
  98. </div>
  99. </div>
  100. </filedset>
  101. </form>
  102. <form class="form-horizontal" name="realmForm" novalidate kc-read-only="!access.manageRealm"
  103. data-ng-show="currentAttribute != null">
  104. <p/>
  105. <legend expanded><span class="text">{{:: 'user.profile.attribute' | translate}} <b
  106. data-ng-show="!isCreateAttribute">{{currentAttribute.name}}</b> {{:: 'configuration' | translate}}</span>
  107. </legend>
  108. <div class="form-group">
  109. <label class="col-md-2 control-label" for="currentAttribute.name">{{:: 'user.profile.attribute.name' | translate}}</label>
  110. <kc-tooltip>{{:: 'user.profile.attribute.name.tooltip' | translate}}</kc-tooltip>
  111. <div class="col-md-4">
  112. <input name="currentAttribute.name" data-ng-model="currentAttribute.name" id="currentAttribute.name"
  113. type="text" class="form-control"
  114. data-ng-readonly="!isCreateAttribute"
  115. data-ng-required="currentAttribute != null"/>
  116. </div>
  117. </div>
  118. <div class="form-group">
  119. <label class="col-md-2 control-label" for="currentAttribute.displayName">{{:: 'user.profile.attribute.displayName' | translate}}</label>
  120. <kc-tooltip>{{:: 'user.profile.attribute.displayName.tooltip' | translate}}</kc-tooltip>
  121. <div class="col-md-4">
  122. <input name="currentAttribute.displayName" data-ng-model="currentAttribute.displayName" id="currentAttribute.displayName"
  123. type="text" class="form-control"/>
  124. </div>
  125. </div>
  126. <div class="form-group">
  127. <label class="col-md-2 control-label" for="currentAttribute.group">{{:: 'user.profile.attribute.group' | translate}}</label>
  128. <div class="col-md-2">
  129. <div>
  130. <select id="select-attributeGroup" data-ng-model="currentAttribute.group" class="form-control"
  131. data-ng-options="group.name as group.name for group in config.groups" >
  132. <option value="" /> <!-- add the "no group" option -->
  133. </select>
  134. </div>
  135. </div>
  136. <kc-tooltip>{{:: 'user.profile.attribute.group.tooltip' | translate}}</kc-tooltip>
  137. </div>
  138. <div class="form-group" data-ng-show="isNotUsernameOrEmail(currentAttribute.name)">
  139. <label class="col-md-2 control-label" for="selectorByScopeSelect">{{:: 'user.profile.attribute.selector.scopes' | translate}}</label>
  140. <kc-tooltip>{{:: 'user.profile.attribute.selector.scopes.tooltip' | translate}}</kc-tooltip>
  141. <div class="col-md-6">
  142. <input type="hidden" ui-select2="selectorByScopeSelect" id="selectorByScopeSelect" data-ng-model="selectorByScope" data-placeholder="Select a scope..." multiple/>
  143. </div>
  144. </div>
  145. <div class="form-group" data-ng-show="isNotUsernameOrEmail(currentAttribute.name)">
  146. <label class="col-md-2 control-label" for="isRequired">{{:: 'user.profile.attribute.required' | translate}}</label>
  147. <kc-tooltip>{{:: 'user.profile.attribute.required.tooltip' | translate}}</kc-tooltip>
  148. <div class="col-md-6">
  149. <input name="isRequired" data-ng-model="isRequired" id="isRequired" onoffswitch
  150. on-text="{{:: 'onText' | translate}}" off-text="{{:: 'offText' | translate}}"/>
  151. </div>
  152. </div>
  153. <div class="form-group" data-ng-show="isRequired">
  154. <label class="col-md-2 control-label" for="isRequiredRoles">{{:: 'user.profile.attribute.required.roles' | translate}}</label>
  155. <kc-tooltip>{{:: 'user.profile.attribute.required.roles.tooltip' | translate}}</kc-tooltip>
  156. <div class="col-md-6">
  157. <input type="hidden" ui-select2="isRequiredRoles" id="isRequiredRoles" data-ng-model="requiredRoles" data-placeholder="Select a role..." multiple/>
  158. </div>
  159. </div>
  160. <div class="form-group" data-ng-show="isRequired">
  161. <label class="col-md-2 control-label" for="isRequiredScopes">{{:: 'user.profile.attribute.required.scopes' | translate}}</label>
  162. <kc-tooltip>{{:: 'user.profile.attribute.required.scopes.tooltip' | translate}}</kc-tooltip>
  163. <div class="col-md-6">
  164. <input type="hidden" ui-select2="isRequiredScopes" id="isRequiredScopes" data-ng-model="requiredScopes" data-placeholder="Select a scope..." multiple/>
  165. </div>
  166. </div>
  167. <fieldset class="border-top" data-ng-show="isNotUsernameOrEmail(currentAttribute.name)">
  168. <legend collapsed><span class="text">{{:: 'user.profile.attribute.permission' | translate}}</span></legend>
  169. <div class="form-group">
  170. <label class="col-md-2 control-label" for="canUserView">{{:: 'user.profile.attribute.canUserView' | translate}}</label>
  171. <kc-tooltip>{{:: 'user.profile.attribute.canUserView.tooltip' | translate}}</kc-tooltip>
  172. <div class="col-md-2">
  173. <input name="canUserView" data-ng-model="canUserView" id="canUserView" onoffswitch
  174. on-text="{{:: 'onText' | translate}}"
  175. off-text="{{:: 'offText' | translate}}"/>
  176. </div>
  177. </div>
  178. <div class="form-group">
  179. <label class="col-md-2 control-label" for="canAdminView">{{:: 'user.profile.attribute.canAdminView' | translate}}</label>
  180. <kc-tooltip>{{:: 'user.profile.attribute.canAdminView.tooltip' | translate}}</kc-tooltip>
  181. <div class="col-md-6">
  182. <input name="canAdminView" data-ng-model="canAdminView" id="canAdminView" onoffswitch
  183. on-text="{{:: 'onText' | translate}}"
  184. off-text="{{:: 'offText' | translate}}"/>
  185. </div>
  186. </div>
  187. <div class="form-group">
  188. <label class="col-md-2 control-label" for="canUserEdit">{{:: 'user.profile.attribute.canUserEdit' | translate}}</label>
  189. <kc-tooltip>{{:: 'user.profile.attribute.canUserEdit.tooltip' | translate}}</kc-tooltip>
  190. <div class="col-md-6">
  191. <input name="canUserEdit" data-ng-model="canUserEdit" id="canUserEdit" onoffswitch
  192. on-text="{{:: 'onText' | translate}}"
  193. off-text="{{:: 'offText' | translate}}"/>
  194. </div>
  195. </div>
  196. <div class="form-group">
  197. <label class="col-md-2 control-label" for="canAdminEdit">{{:: 'user.profile.attribute.canAdminEdit' | translate}}</label>
  198. <kc-tooltip>{{:: 'user.profile.attribute.canAdminEdit.tooltip' | translate}}</kc-tooltip>
  199. <div class="col-md-6">
  200. <input name="canAdminEdit" data-ng-model="canAdminEdit" id="canAdminEdit" onoffswitch
  201. on-text="{{:: 'onText' | translate}}"
  202. off-text="{{:: 'offText' | translate}}"/>
  203. </div>
  204. </div>
  205. </fieldset>
  206. <fieldset>
  207. <legend collapsed><span class="text">{{:: 'user.profile.attribute.validation' | translate}}</span></legend>
  208. <div class="form-group">
  209. <label class="col-md-2 control-label" for="create-validator">{{:: 'user.profile.attribute.validation.add.validator' | translate}}</label>
  210. <kc-tooltip>{{:: 'user.profile.attribute.validation.add.validator.tooltip' | translate}}</kc-tooltip>
  211. <div class="col-sm-4">
  212. <select id="create-validator" class="form-control" ng-model="newValidator"
  213. ng-options="p.id for p in validatorProviders"
  214. data-ng-change="selectValidator(newValidator)">
  215. <option value="" disabled selected>{{:: 'user.profile.attribute.validation.add.validator' | translate}}...</option>
  216. </select>
  217. </div>
  218. </div>
  219. <kc-component-config realm="realm" config="newValidator.config"
  220. properties="newValidator.properties"></kc-component-config>
  221. <p/>
  222. <div class="form-group" data-ng-show="newValidator != null">
  223. <div class="col-md-10 col-md-offset-2" data-ng-show="access.manageRealm">
  224. <button class="btn btn-primary" data-ng-click="addValidator(newValidator)">{{:: 'add' | translate}}</button>
  225. <button class="btn btn-primary" data-ng-click="cancelAddValidator()">{{:: 'cancel' | translate}}</button>
  226. </div>
  227. </div>
  228. <div class="form-group col-sm-10">
  229. <table class="datatable table table-striped table-bordered dataTable no-footer">
  230. <thead>
  231. <tr>
  232. <th width="20%">{{:: 'name' | translate}}</th>
  233. <th>{{:: 'config' | translate}}</th>
  234. <th colspan="2">{{:: 'actions' | translate}}</th>
  235. </tr>
  236. </thead>
  237. <tbody>
  238. <tr ng-repeat="(key, value) in currentAttribute.validations">
  239. <td>{{key}}</td>
  240. <td>{{value}}</td>
  241. <td class="kc-action-cell" data-ng-click="removeValidator(key)">{{:: 'delete' | translate}}</td>
  242. </tr>
  243. <tr data-ng-show="!currentAttribute.validations || currentAttribute.validations.length == 0">
  244. <td class="text-muted" colspan="3">{{:: 'user.profile.attribute.validation.no.validators' | translate}}</td>
  245. </tr>
  246. </tbody>
  247. </table>
  248. </div>
  249. </fieldset>
  250. <fieldset>
  251. <legend collapsed><span class="text">{{:: 'user.profile.attribute.annotation' | translate}}</span></legend>
  252. <div class="form-group col-sm-10">
  253. <table class="table table-striped table-bordered">
  254. <thead>
  255. <tr>
  256. <th>{{:: 'key' | translate}}</th>
  257. <th>{{:: 'value' | translate}}</th>
  258. <th>{{:: 'actions' | translate}}</th>
  259. </tr>
  260. </thead>
  261. <tbody>
  262. <tr ng-repeat="(key, value) in currentAttribute.annotations | toOrderedMapSortedByKey">
  263. <td>{{key}}</td>
  264. <td><input ng-model="currentAttribute.annotations[key]" class="form-control" type="text" name="{{key}}"
  265. id="attribute-{{key}}"/></td>
  266. <td class="kc-action-cell" data-ng-click="removeAttributeAnnotation(key)">{{:: 'delete' | translate}}</td>
  267. </tr>
  268. <tr>
  269. <td><input ng-model="newAnnotation.key" class="form-control" type="text" id="newAnnotationKey"/></td>
  270. <td><input ng-model="newAnnotation.value" class="form-control" type="text" id="newAnnotationValue"/></td>
  271. <td class="kc-action-cell" data-ng-click="addAttributeAnnotation()"
  272. data-ng-disabled="!newAnnotation.key.length || !newAnnotation.value.length">{{:: 'add' | translate}}
  273. </td>
  274. </tr>
  275. </tbody>
  276. </table>
  277. </div>
  278. </fieldset>
  279. <div class="form-group">
  280. <p/>
  281. <div class="col-md-10 col-md-offset-2" data-ng-show="access.manageRealm">
  282. <button kc-save>{{:: 'save' | translate}}</button>
  283. <button kc-reset>{{:: 'cancel' | translate}}</button>
  284. </div>
  285. </div>
  286. </form>
  287. <form class="form-horizontal" name="realmForm" novalidate kc-read-only="!access.manageRealm"
  288. data-ng-show="currentAttributeGroup != null">
  289. <p/>
  290. <legend expanded><span class="text">{{:: 'user.profile.attributegroup' | translate}} <b
  291. data-ng-show="!isCreateAttributeGroup">{{currentAttributeGroup.name}}</b> {{:: 'configuration' | translate}}</span>
  292. </legend>
  293. <div class="form-group">
  294. <label class="col-md-2 control-label" for="currentAttributeGroup.name">{{:: 'user.profile.attributegroup.name' | translate}}</label>
  295. <kc-tooltip>{{:: 'user.profile.attributegroup.name.tooltip' | translate}}</kc-tooltip>
  296. <div class="col-md-4">
  297. <input name="currentAttributeGroup.name" data-ng-model="currentAttributeGroup.name" id="currentAttributeGroup.name"
  298. type="text" class="form-control"
  299. data-ng-readonly="!isCreateAttributeGroup"
  300. data-ng-required="currentAttributeGroup != null"/>
  301. </div>
  302. </div>
  303. <div class="form-group">
  304. <label class="col-md-2 control-label" for="currentAttributeGroup.displayHeader">{{:: 'user.profile.attributegroup.displayHeader' | translate}}</label>
  305. <kc-tooltip>{{:: 'user.profile.attributegroup.displayHeader.tooltip' | translate}}</kc-tooltip>
  306. <div class="col-md-4">
  307. <input name="currentAttributeGroup.displayHeader" data-ng-model="currentAttributeGroup.displayHeader" id="currentAttributeGroup.displayHeader"
  308. type="text" class="form-control"/>
  309. </div>
  310. </div>
  311. <div class="form-group">
  312. <label class="col-md-2 control-label" for="currentAttributeGroup.displayDescription">{{:: 'user.profile.attributegroup.displayDescription' | translate}}</label>
  313. <kc-tooltip>{{:: 'user.profile.attributegroup.displayDescription.tooltip' | translate}}</kc-tooltip>
  314. <div class="col-md-4">
  315. <input name="currentAttributeGroup.displayDescription" data-ng-model="currentAttributeGroup.displayDescription" id="currentAttributeGroup.displayDescription"
  316. type="text" class="form-control"/>
  317. </div>
  318. </div>
  319. <fieldset>
  320. <legend collapsed><span class="text">{{:: 'user.profile.attributegroup.annotation' | translate}}</span></legend>
  321. <div class="form-group col-sm-10">
  322. <table class="table table-striped table-bordered">
  323. <thead>
  324. <tr>
  325. <th>{{:: 'key' | translate}}</th>
  326. <th>{{:: 'value' | translate}}</th>
  327. <th>{{:: 'actions' | translate}}</th>
  328. </tr>
  329. </thead>
  330. <tbody>
  331. <tr ng-repeat="(key, value) in currentAttributeGroup.annotations | toOrderedMapSortedByKey">
  332. <td>{{key}}</td>
  333. <td><input ng-model="currentAttributeGroup.annotations[key]" class="form-control" type="text" name="{{key}}"
  334. id="attributegroup-{{key}}"/></td>
  335. <td class="kc-action-cell" data-ng-click="removeAttributeGroupAnnotation(key)">{{:: 'delete' | translate}}</td>
  336. </tr>
  337. <tr>
  338. <td><input ng-model="newAttributeGroupAnnotation.key" class="form-control" type="text" id="newAttributeGroupAnnotationKey"/></td>
  339. <td><input ng-model="newAttributeGroupAnnotation.value" class="form-control" type="text" id="newAttributeGroupAnnotationValue"/></td>
  340. <td class="kc-action-cell" data-ng-click="addAttributeGroupAnnotation()"
  341. data-ng-disabled="!newAttributeGroupAnnotation.key.length || !newAttributeGroupAnnotation.value.length">{{:: 'add' | translate}}
  342. </td>
  343. </tr>
  344. </tbody>
  345. </table>
  346. </div>
  347. </fieldset>
  348. <div class="form-group">
  349. <p/>
  350. <div class="col-md-10 col-md-offset-2" data-ng-show="access.manageRealm">
  351. <button kc-save>{{:: 'save' | translate}}</button>
  352. <button class="btn btn-default" data-ng-click="cancelEditAttributeGroup()">{{:: 'cancel' | translate}}</button>
  353. </div>
  354. </div>
  355. </form>
  356. </div>
  357. <kc-menu></kc-menu>