|
|
|
@ -28,7 +28,10 @@ const ServiceAccountListItem = memo( |
|
|
|
|
const editUrl = `org/serviceaccounts/${serviceAccount.id}`; |
|
|
|
|
const styles = useStyles2(getStyles); |
|
|
|
|
const canUpdateRole = contextSrv.hasPermissionInMetadata(AccessControlAction.ServiceAccountsWrite, serviceAccount); |
|
|
|
|
const rolePickerDisabled = !canUpdateRole; |
|
|
|
|
const displayRolePicker = |
|
|
|
|
contextSrv.hasPermission(AccessControlAction.ActionRolesList) && |
|
|
|
|
contextSrv.hasPermission(AccessControlAction.ActionUserRolesList); |
|
|
|
|
const enableRolePicker = contextSrv.hasPermission(AccessControlAction.OrgUsersRoleUpdate) && canUpdateRole; |
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
|
<tr key={serviceAccount.id}> |
|
|
|
@ -61,26 +64,30 @@ const ServiceAccountListItem = memo( |
|
|
|
|
{serviceAccount.login} |
|
|
|
|
</a> |
|
|
|
|
</td> |
|
|
|
|
<td className={cx('link-td', styles.iconRow)}> |
|
|
|
|
{contextSrv.licensedAccessControlEnabled() ? ( |
|
|
|
|
<UserRolePicker |
|
|
|
|
userId={serviceAccount.id} |
|
|
|
|
orgId={serviceAccount.orgId} |
|
|
|
|
builtInRole={serviceAccount.role} |
|
|
|
|
onBuiltinRoleChange={(newRole) => onRoleChange(newRole, serviceAccount)} |
|
|
|
|
roleOptions={roleOptions} |
|
|
|
|
builtInRoles={builtInRoles} |
|
|
|
|
disabled={rolePickerDisabled} |
|
|
|
|
/> |
|
|
|
|
) : ( |
|
|
|
|
{contextSrv.licensedAccessControlEnabled() ? ( |
|
|
|
|
displayRolePicker && ( |
|
|
|
|
<td className={cx('link-td', styles.iconRow)}> |
|
|
|
|
<UserRolePicker |
|
|
|
|
userId={serviceAccount.id} |
|
|
|
|
orgId={serviceAccount.orgId} |
|
|
|
|
builtInRole={serviceAccount.role} |
|
|
|
|
onBuiltinRoleChange={(newRole) => onRoleChange(newRole, serviceAccount)} |
|
|
|
|
roleOptions={roleOptions} |
|
|
|
|
builtInRoles={builtInRoles} |
|
|
|
|
disabled={!enableRolePicker} |
|
|
|
|
/> |
|
|
|
|
</td> |
|
|
|
|
) |
|
|
|
|
) : ( |
|
|
|
|
<td className={cx('link-td', styles.iconRow)}> |
|
|
|
|
<OrgRolePicker |
|
|
|
|
aria-label="Role" |
|
|
|
|
value={serviceAccount.role} |
|
|
|
|
disabled={!canUpdateRole} |
|
|
|
|
onChange={(newRole) => onRoleChange(newRole, serviceAccount)} |
|
|
|
|
/> |
|
|
|
|
)} |
|
|
|
|
</td> |
|
|
|
|
</td> |
|
|
|
|
)} |
|
|
|
|
<td className="link-td max-width-10"> |
|
|
|
|
<a |
|
|
|
|
className="ellipsis" |
|
|
|
|