In a standard, generated list view, how can I hide certain ActionLinks based on the roles the logged in user belongs to?
My friend wrote up this blog post about supporting multiple roles in security checks without "magic strings". (He discusses action links at the end.) I also have a comment there. I recommend putting the logic to determine permissions into your view model so that you don't clutter your view with permission checks.
Related
I want to design an asp.net webpage at run-time which are configured by admin user.
Means , Admin user will define metadata of a webpage (they will define the number and type of controls user will see based on different condition).
Once the page definitions are defined by admin users the normal users will see different view of a page based on their role.
Please suggest which is the best way to address this requirement. I am using Asp.net 2010.
Thanks in advance
There's not a lot of information to go on here. Do all users see the same page? Are there groups of users who see different items? Or are the pages fully customized for each user?
I would make a database of users and fields. For example, fields could be "CanAccessFoo" and "CanAccessBar", etc. Admins would have a page where they can edit users to change these. You could implement a group as well such as "View Only" that has certain properties and assign users to that group.
Then in your page (you don't even say if you're using MVC or web pages), you would dynamically show the controls based on your model which must contain the user.
#if (Model.User.CanAccessFoo) {
#Html.EditorFor(m => m.Foo)
}
Simple question for all of you here dealing with Drupal 6.x...
With Drupal's Add More module, is there a way to configure my webform so that there is no limit on how many of a specific fields I can add more of?
Please see my image for example:
For example, I'd like to enable the user to add as many titles as they would like. Is that doable?
Unfortunately, it's not currently possible to add unlimited "add another" functionality with webforms. And if this functionality does become a reality someday, I doubt it will be backported to the Drupal 6 version of the module. From the webform modules author (quicksketch):
there is no progress on this subject. The ability to support multiple
values requires a tremendous amount of re-architecting, including
changes to the way CSVs are generated, analysis, the database
structure, and the UI (both for administrators and users). I wouldn't
expect this feature to be added any time soon.
See this thread for more information:
http://drupal.org/node/354381
I would suggest using a node and the CCK module plus rules and views to collect this information.
Assumptions:
Anonymous users can fill out the current form
You need some way of retrieving the data that is submitted
Regular users of the site should not be able to view submissions
Very loose directions:
Create a content type and add all of the fields that your current webform contains to it. CCK has the ability to store unlimited values out of the box. On the field settings page, inside the Global Settings fieldset, select "Unlimited" for the "Number of Values" field.
Give anonymous users permission to Create [your-new-content-type] Content on the Role Permissions page.
Using the Rules module, create a new triggered rule that fires on "Content is about to be viewed" with an condition "Content has type [your-new-content-type]" and an action of redirect to homepage (or a custom error page that you created). (Note: this is a bit of a performance hit. There are better ways to restrict access to this content type, but for the sake of this tutorial, this was the easiest to explain)
Using the Views module, create a new view with Style set to Table. Add each of the fields in [your-new-content-type] in the fields section. Under "Access" choose "role" and select the role that is assigned to your user. Add a "page" display, give it a Path and save. This is the page you will use to view submissions.
Optional:
Use the Rules module to send yourself (or the submitter) an email when a node of [your-new-content-type] is created.
I want to implement search functionality in plone. Search depending on users , users email. Want to display user full details.
Is there any existing add on which I can use (or) I have to write my own code.
Plone does not do "users by content" by default.
User objects are not registered as content
Thus, the standard Plone search functionality does not cover users
If you wish to make users visible for everyone and searchable
There is add-on http://pypi.python.org/pypi/Products.remember/ which will turn users to content items and this serve some niche use cases
Alternatively, you can write your own search box view like Users/Group page in Site setup does
If you need members to be public on your site I would suggest take a look on Products.remember. It will also give you the ability to extend user records through Archetypes content subsystem and make them subject to workflow menu (have different states for members like disabled, registered, etc.)
http://collective-docs.readthedocs.org/en/latest/content/archetypes/index.html
I'm trying to create a rule/ruleset that:
Is triggered when a user registered with the site
Then (depending on a CCK field value included in the registration) add that user to a role
Then redirect the user to a profile page.
I've tried no end of times and simply can't get it to work.
I can create a triggered rule which fires upon registration (but doesn't allow me to perform all actions needed), nor does it allow me to select the ruleset with all the actions needed using rules schedular.
One of the reasons I'm not allowed to select the ruleset under a triggered rule is the "arguments are not passed".
Any help is really appreciated or perhaps another way of achieving what I'm trying to do.
I am gonna guess that you are probably using content the module content profile to use CCK content types for user profiles, and that you have the content profile fields visible in the registration form. your problem is that you need to load the profile to be able to access values in the fields there.
Your best bet is to use http://drupal.org/project/autoassignrole to handle the role assignment and then, use a rule to set the content profile field (if you really need to set that) once the user logs in.
What I need to accomplish is this:
If an anonymous user visits the site, show regular site content.
If a user logs in to the site, then user-related content appears in place of the regular content.
I would like to accomplish this using the Views module.
I have looked at the Premium module, but it seems to be abandoned. I would like to avoid using the content-access module if at all possible, since I already have other access controls in place.
If you are creating a page display for the views, you can accomplish this with view's access controls. Views will show the first available display that the user has permissions to.
Create a display for the authenticated user view
Set the page path
Set the Access restrictions (eg., by Authenticated role)
Create a display for the anonymous user view
Set the page path to the same value
Optionally restrict access to the Anonymous role (not necessary, since if views can load the authenticated display for the user it will not bother with this one, but may keep it's use clear)
Since you cannot re-order the displays in a view (yet), you must define the views in the order of most restrictive to least restrictive.
For more complex displays, you can use the Panels Pages module to render the page differently based on a user's role.
If you only want to differentiate between anonymous and authenticated users, you can specify that different content blocks are visible to each role.
On my own site, I needed to differentiate between Administrators and everyone else, so I could not use the authenticated user role to define access for individual items. Similar to Views, with Panels Pages you can define multiple variants of pages that use the same path. Administrators have access to the first variant, and all other users fall through to using the second.
You could try using the CCK content permissions and set permissions on a per field basis. Then have different fields for different content that you want to publish. I believe this is included with the CCK module.