Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow ability to hook into users blueprint #400

Closed
jelleroorda opened this issue Dec 4, 2020 · 1 comment
Closed

Allow ability to hook into users blueprint #400

jelleroorda opened this issue Dec 4, 2020 · 1 comment

Comments

@jelleroorda
Copy link

What is quite neat in my opinion is the following snippet from the Statamic\Http\Controllers\CP\Users\UsersController@edit (with also code going along in the update method of course):

$blueprint = $user->blueprint();

if (! User::current()->can('edit roles')) {
    $blueprint->ensureField('roles', ['read_only' => true]);
}

if (! User::current()->can('edit user groups')) {
    $blueprint->ensureField('groups', ['read_only' => true]);
}

Would it be possible to add an event to the edit and update method of the controller, so we can add extra fields that may be read-only for some users, and editable for others in the same way?

@jasonvarga
Copy link
Member

Keep an eye on statamic/cms#2983

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants