# Setting 'min username length' greater than 5 breaks granting and revoking Admin/Moderator permissions

**URL:** <https://meta.discourse.org/t/setting-min-username-length-greater-than-5-breaks-granting-and-revoking-admin-moderator-permissions/57079>\
**Category:** Bug\
**Created:** [7 Febrero, 2017 16:50 UTC](https://meta.discourse.org/t/setting-min-username-length-greater-than-5-breaks-granting-and-revoking-admin-moderator-permissions/57079 "2017-02-07T16:50:10Z")\
**Posts on this page:** 1\
**Showing post:** 9

<div class="post-metadata">

**Author:** ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)\
**Post date:** [7 Febrero, 2017 19:13 UTC](https://meta.discourse.org/t/setting-min-username-length-greater-than-5-breaks-granting-and-revoking-admin-moderator-permissions/57079/9 "2017-02-07T19:13:06Z")

</div>

Long term I would prefer if we had a “validation” routine that runs every time you try to increase length for this key:

```plaintext
if min_user_name_length.increased? 
   if User.where('length(username) < :size', size: min_user_name_length).exists? 
     raise "sorry, but this is not gonna happen"
   end
    if Group.where('length(name) < :size', size: min_user_name_length).exists? 
     raise "sorry, but this is also not gonna happen"
   end
end

```

---

_[View the full topic](https://meta.discourse.org/t/setting-min-username-length-greater-than-5-breaks-granting-and-revoking-admin-moderator-permissions/57079)._
