Fossil SCM
Fix the fullcap() SQL function so that it correctly expands the capabilities of Admin and Setup users to include everything.
Commit
384fdb6b4ffb54bbb08acfa30a88cfd9ce1e6f7046c007152d23c97d8d8efe49
Parent
7bd4bca2f4b6bdb…
1 file changed
+4
+4
| --- src/capabilities.c | ||
| +++ src/capabilities.c | ||
| @@ -100,10 +100,11 @@ | ||
| 100 | 100 | void capability_expand(CapabilityString *pIn){ |
| 101 | 101 | static char *zNobody = 0; |
| 102 | 102 | static char *zAnon = 0; |
| 103 | 103 | static char *zReader = 0; |
| 104 | 104 | static char *zDev = 0; |
| 105 | + static char *zAdmin = "bcdefghijklmnopqrtwxz234567AD"; | |
| 105 | 106 | int doneV = 0; |
| 106 | 107 | |
| 107 | 108 | if( pIn==0 ){ |
| 108 | 109 | fossil_free(zNobody); zNobody = 0; |
| 109 | 110 | fossil_free(zAnon); zAnon = 0; |
| @@ -117,10 +118,13 @@ | ||
| 117 | 118 | zReader = db_text(0, "SELECT cap FROM user WHERE login='reader'"); |
| 118 | 119 | zDev = db_text(0, "SELECT cap FROM user WHERE login='developer'"); |
| 119 | 120 | } |
| 120 | 121 | pIn = capability_add(pIn, zAnon); |
| 121 | 122 | pIn = capability_add(pIn, zNobody); |
| 123 | + if( pIn->x['a'] || pIn->x['s'] ){ | |
| 124 | + pIn = capability_add(pIn, zAdmin); | |
| 125 | + } | |
| 122 | 126 | if( pIn->x['v'] ){ |
| 123 | 127 | pIn = capability_add(pIn, zDev); |
| 124 | 128 | doneV = 1; |
| 125 | 129 | } |
| 126 | 130 | if( pIn->x['u'] ){ |
| 127 | 131 |
| --- src/capabilities.c | |
| +++ src/capabilities.c | |
| @@ -100,10 +100,11 @@ | |
| 100 | void capability_expand(CapabilityString *pIn){ |
| 101 | static char *zNobody = 0; |
| 102 | static char *zAnon = 0; |
| 103 | static char *zReader = 0; |
| 104 | static char *zDev = 0; |
| 105 | int doneV = 0; |
| 106 | |
| 107 | if( pIn==0 ){ |
| 108 | fossil_free(zNobody); zNobody = 0; |
| 109 | fossil_free(zAnon); zAnon = 0; |
| @@ -117,10 +118,13 @@ | |
| 117 | zReader = db_text(0, "SELECT cap FROM user WHERE login='reader'"); |
| 118 | zDev = db_text(0, "SELECT cap FROM user WHERE login='developer'"); |
| 119 | } |
| 120 | pIn = capability_add(pIn, zAnon); |
| 121 | pIn = capability_add(pIn, zNobody); |
| 122 | if( pIn->x['v'] ){ |
| 123 | pIn = capability_add(pIn, zDev); |
| 124 | doneV = 1; |
| 125 | } |
| 126 | if( pIn->x['u'] ){ |
| 127 |
| --- src/capabilities.c | |
| +++ src/capabilities.c | |
| @@ -100,10 +100,11 @@ | |
| 100 | void capability_expand(CapabilityString *pIn){ |
| 101 | static char *zNobody = 0; |
| 102 | static char *zAnon = 0; |
| 103 | static char *zReader = 0; |
| 104 | static char *zDev = 0; |
| 105 | static char *zAdmin = "bcdefghijklmnopqrtwxz234567AD"; |
| 106 | int doneV = 0; |
| 107 | |
| 108 | if( pIn==0 ){ |
| 109 | fossil_free(zNobody); zNobody = 0; |
| 110 | fossil_free(zAnon); zAnon = 0; |
| @@ -117,10 +118,13 @@ | |
| 118 | zReader = db_text(0, "SELECT cap FROM user WHERE login='reader'"); |
| 119 | zDev = db_text(0, "SELECT cap FROM user WHERE login='developer'"); |
| 120 | } |
| 121 | pIn = capability_add(pIn, zAnon); |
| 122 | pIn = capability_add(pIn, zNobody); |
| 123 | if( pIn->x['a'] || pIn->x['s'] ){ |
| 124 | pIn = capability_add(pIn, zAdmin); |
| 125 | } |
| 126 | if( pIn->x['v'] ){ |
| 127 | pIn = capability_add(pIn, zDev); |
| 128 | doneV = 1; |
| 129 | } |
| 130 | if( pIn->x['u'] ){ |
| 131 |